question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

imported css not compressed

See original GitHub issue

The 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Panyacommented, Mar 30, 2016

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.

0reactions
laurentpayotcommented, Aug 1, 2021

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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found