BlessCSS / bless

CSS Post-Processor
blesscss.com
MIT License
282 stars 60 forks source link

is @import a bad practice? #53

Closed GalCohen closed 9 years ago

GalCohen commented 9 years ago

Hi guys,

I'm interested in using this tool, and trying to get a better handle on how it works.

I was under the impression that @import statements should always be avoided in favor of multiple <link> tags so that the stylesheets can be downloaded concurrently. see this SO question: http://stackoverflow.com/questions/10036977/best-way-to-include-css-why-use-import

So am i misunderstanding how bless works? is @import just unavoidable in this case? is there a way to make it conditional to IE?

adam-lynch commented 9 years ago

You can turn the @imports off. I created gulp-bless and I use that with link-assets* to add the multiple <link>s to my html.

* You could use gulp-useref / gulp-usemin or a whole list of other plugins instead of link-assets also.

aabenoja commented 9 years ago

The default behavior is to use @import to make it fairly seamless to use bless. As @adam-lynch mentioned, there is a --no-imports flag you can toggle on to prevent the @import rules from being added to your stylesheet.

paulyoung commented 9 years ago

As others have mentioned, using @import is optional but is the default.

This is to avoid having to make external code changes or constantly check if the number of CSS files changed.