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

CSS

Ihor Zhuk
Ihor Zhuk
13,263 Points

@import (inline) in Sass

Hello!

I was wondering is there an analog of @import (inline) in Sass?

In Less, it's possible to include the source file in the output but do not process it. Does Sass have similar feature?

Thank you!

3 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

If I'm right these are called "Partial" files in SASS.

To ouput a partial file but not process it I think you need to precede the filemame with an underscore. "_filname.scss"

Garrett Levine
Garrett Levine
20,305 Points

When you are creating partials, you save them with an underscore as mentioned above!

a file name might look like ... _noramlize.scss

when importing them into your main.scss file, you need to provide the path, but not the '_' (SCSS will know what you're talking about).

@import "normalize";
@import "header";
@import "footer";

I love partials <3

Ihor Zhuk
Ihor Zhuk
13,263 Points

Thank you for answers!

Sorry, my question was unclear. In Less, directive @import (inline) allows to concatenate .css and even min.css with .less files. In other words, we can import simple css. So, is it possible with us? (without using special plugins for concatenation)

Garrett Levine
Garrett Levine
20,305 Points

hm, I don't think so, actually!