GithubHelp home page GithubHelp logo

Multiline comments removed? about pyscss HOT 7 CLOSED

endorama avatar endorama commented on August 20, 2024
Multiline comments removed?

from pyscss.

Comments (7)

Kronuz avatar Kronuz commented on August 20, 2024

Yes comments are entirely removed as part of the parsing process... I know that's not entirely desirable always, but at the moment there's no way of keeping comments. We definitely need to find a way to have them.

from pyscss.

tghw avatar tghw commented on August 20, 2024

This behavior does not follow the SASS language guidelines, which states multiline comments (delineated by /* and */) should be "preserved in the CSS output where possible" (http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#comments). I take this to mean that the comments will be kept as long as compression is off.

Can you expand on why "there's no way of keeping comments" at the moment?

from pyscss.

amery avatar amery commented on August 20, 2024

most probably because the "compiler" drops comments as whitespace very early

from pyscss.

tghw avatar tghw commented on August 20, 2024

Yes, I see there is an explicit step to do this on https://github.com/Kronuz/pyScss/blob/master/scss/__init__.py#L781, but even if that call is removed, comments still seem to get taken out, but I'm not seeing where.

from pyscss.

Kronuz avatar Kronuz commented on August 20, 2024

You can't simply remove that line that removes comments, the rest of the compiler expects those lines not to exist, and having them sill there would make the compiler try to treat them as rules. To make it work, one has to add a special rule type for comments (so it can added to the children of the current rule and later printed during the output). Then, locate_blocks() needs to know about the comments, looking for /* and */, and returning those "special" new rules. I'd add a @comment property rule, which it's block would be the comment itself... this way locate_blocks() would return @comment as a new property name, and the comment as the codestr. While printing, one would take those special rules, and print them as comments instead. It still would not be possible to gather all comments (specially those added inbetween selectors).

from pyscss.

eevee avatar eevee commented on August 20, 2024

One other consideration: we may want to preserve top-of-file javadoc-style (/** ... */) comment blocks even when compressing, as these tend to be copyright notices or licenses or the like. e.g.:

from pyscss.

endorama avatar endorama commented on August 20, 2024

Closing this issue because is too old. Feel free to reopen if necessary.

from pyscss.

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.