Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sass, Compass, compile all CSS file to one [duplicate]

Now, while I am developing my project I have three files, "main.css", "about.css" and "news.css" (for example). Is it possible to compile them into one "final.css" for production?

like image 627
MyMomSaysIamSpecial Avatar asked Oct 23 '12 07:10

MyMomSaysIamSpecial


People also ask

Does Sass compile to CSS?

Once Sass is installed, you can compile your Sass to CSS using the sass command. You'll need to tell Sass which file to build from, and where to output CSS to. For example, running sass input.scss output.css from your terminal would take a single Sass file, input.scss , and compile that file to output.css .

What is @import in Sass?

Sass Importing Files The @import directive allows you to include the content of one file in another. The CSS @import directive has a major drawback due to performance issues; it creates an extra HTTP request each time you call it.

What is Compass compile?

Compass is an open-source CSS authoring framework which uses the Sass stylesheet language to make writing stylesheets powerful and easy.


1 Answers

The SASS import directive is used to import the contents of one file into another, so you could create a file final.scss whose contents are:

@import 'main';
@import 'about';
@import 'news';

You'd then need to rename your files to have "scss" extensions so the import directive will find them. If you don't want the main.scss, about.scss, and news.scss files to compile to CSS files themselves, you can use partials by prefixing the filenames with an underscore (i.e., _main.scss, _about.scss, _news.scss).

like image 72
hopper Avatar answered Nov 13 '22 22:11

hopper