Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline comments removed? #12

Closed
endorama opened this issue Mar 23, 2011 · 7 comments
Closed

Multiline comments removed? #12

endorama opened this issue Mar 23, 2011 · 7 comments

Comments

@endorama
Copy link

Are multiline comments preserved in compiled css? I done some tests, and seems that multiline comments are stripped during compilation

@Kronuz
Copy link
Owner

Kronuz commented Mar 25, 2011

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.

@tghw
Copy link

tghw commented Dec 13, 2011

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?

@amery
Copy link

amery commented Dec 13, 2011

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

@tghw
Copy link

tghw commented Dec 13, 2011

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.

@Kronuz
Copy link
Owner

Kronuz commented Dec 13, 2011

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).

@eevee
Copy link
Collaborator

eevee commented May 3, 2013

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.:

@endorama
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants