imported css not compressed
See original GitHub issueThe contents of an inline imported a .css file (using --include-css
) is not compressed by --compress
argument.
normalize.css
/* normalize.css */
html {
font-family: sans-serif;
}
style.styl
@import 'normalize.css'
/* start of CSS */
body {
box-sizing: border-box;
}
Run stylus:
>stylus --include-css --compress style.styl
compiled style.css
style.css
/*! normalize.css v0.0.1 */
html {
font-family: sans-serif;
}
body{box-sizing:border-box}
In the resulting file, the contents of the .styl has been compressed, but contents of the .css file has not.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Best way to include CSS? Why use @import? - Stack Overflow
Yes, always use @import and external Cascading Style Sheets in your Website! CSS does NOT need to be compressed, minimized, preprocessed, etc. And...
Read more >The complete best practices for minifying CSS - LogRocket Blog
Minifying CSS files is more nuanced than you might think at first. ... Compression does not necessarily alter the content of code —...
Read more >Lighthouse: Avoid CSS @import - GTmetrix
CSS @import is the process of calling stylesheets/CSS files from within another CSS file. This method causes the browser to load each CSS...
Read more >Imported scss files are not compiled to css #29 - GitHub
When using the compress tag to compile a main scss files, only scss codes written in the main file are compiled ignoring all...
Read more >Compress CSS with @import statements - Chris Miller
Compress CSS with @import statements · grab the contents of the main controller CSS file · remove the comments · find all the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’ll remove built-in compression in 1.0 version of Stylus because we think that tools for CSS optimization (like CSSO or cleancss) are better suitable for this task.
Using dedicated CSS optimization tools makes sense, but it was a surprise for me to see my imported CSS not compressed with the
--compress
option. I was going to open an issue and found this one. To avoid surprises like this to new users it would be worth mentioning this behavior in the docs…