Giter Site home page Giter Site logo

Comments (6)

kevinsawicki avatar kevinsawicki commented on July 30, 2024 1

Would you please tell me the difference between '.html' and '.text.html'?

.html matches elements with just the html CSS class, .text.html matches elements that have both the html and text CSS classes.

The snippets system uses the "best match" to determine which snippet to run and ties favor the snippets in ~/.atom/snippets.cson so you needed to have a selector as specific as the built-in one for it to be properly overridden.

https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started/Selectors

from snippets.

kevinsawicki avatar kevinsawicki commented on July 30, 2024

Does this work?

'.text.html': 
  'script':
        'prefix': 'script'
        'body': """
            <script>
                $1
            </script>
        """

from snippets.

dragonwong avatar dragonwong commented on July 30, 2024

That works! Thank you very much! 😁
Would you please tell me the difference between '.html' and '.text.html'?

from snippets.

dragonwong avatar dragonwong commented on July 30, 2024

.html matches elements with just the html CSS class, .text.html matches elements that have both the html and text CSS classes.

I know CSS selector, but I do not understand that a file has CSS classes. And I do not know how to get classes of a file?

I guess .html means the suffix of the file name, but .text means what?

from snippets.

kevinsawicki avatar kevinsawicki commented on July 30, 2024

Atom has a tokenizer that uses TextMate grammars and converts the TextMate scopes to CSS selectors when it creates the DOM elements.

So if you look at the HTML grammar, the root scope name is text.html.basic meaning that all HTML lines will have the text, html, and basic CSS classes on it.

https://github.com/atom/language-html/blob/5243fe487978fb1883245bcdc1d638ad0ee8c3b1/grammars/html.cson#L1

from snippets.

dragonwong avatar dragonwong commented on July 30, 2024

Thank you for your answer! 👻

from snippets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.