Comments (7)
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.
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.
most probably because the "compiler" drops comments as whitespace very early
from pyscss.
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.
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.
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.
Closing this issue because is too old. Feel free to reopen if necessary.
from pyscss.
Related Issues (20)
- Setuptools `Features` is removed from v.46.0.0 HOT 9
- 1.3.6 broken on windows py2 HOT 13
- hashtable.c can't be compiled with msvc14 on windows HOT 3
- PyScss 1.3.7 causes long static asset compression times HOT 2
- pyScss doesn't seem to be able to compile certain SCSS files
- compilation breaks var() HOT 2
- Py_UNICODE is deprecated since Python 3.3
- ZeroDivisionError when evaluating linear-gradient() HOT 1
- Deprecation warning due to invalid escape sequences
- self-tests fail against Pytest 6.0.1
- Support @use
- Status of this project? HOT 5
- pyScss can't compile Bulma
- No tags for 1.3.6 and 1.3.7 HOT 2
- 1.3.7: test suite is failing HOT 5
- Different compilation results with and without libpcre
- Use a FIPS compliant algorithm
- pyscss not usable in Python 3.10 HOT 3
- Many test failures under Python 3.11 HOT 2
- Upgrading pyScss from pcre to pcre2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyscss.