Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Introduction to Front End Performance Optimization Optimize Assets Optimize CSS

Cale Matteson
Cale Matteson
11,303 Points

Where is @import appropriate?

Seems like pretty solid logic for not using the @import. I was taught 'never say never' as a kid so my question is where is @import appropriate to use? If it were truly 'never' to be used, why not remove it from support?

1 Answer

@import lets you split your css into smaller, more maintainable files. A major drawback is that each time you use @import in css, it creates another http request. But, if you use a preprocessor such as Sass, you can have the benefit of smaller, simpler css files using @import and they will be combined and served as a single file to the browser.

jobbol
seal-mask
.a{fill-rule:evenodd;}techdegree
jobbol
Full Stack JavaScript Techdegree Student 17,238 Points

So using Sass means better organized CSS with the same performance.

Thanks so much. I was about to ask about using multiple sheets for this reason.