Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can compass merge .css files? [duplicate]

I am trying to find out if Compass can merge .css files rather than using a third party tool to merge the .css files after Compass has compiled the .scss files. I have looked around the web and on here but nothing so far. I thought the config.rb may have an option for this but all I found is compress feature.

Anyone tried this or have a found a third party tool that works well with compass?

like image 427
Sancho_UK Avatar asked Feb 15 '12 12:02

Sancho_UK


1 Answers

I'd wanted to do this same thing for quite some time. I finally settled on the following solution.

Take the following structure (i.e. with your modules in a sub-folder of sass)

  • project
    • sass
      • modules
        • header.scss
        • blog-posts.scss
        • footer.scss
        • something-else.scss
      • main.scss
    • stylesheets

Update main.scss to contain:

@import 'modules/header.scss';
@import 'modules/blog-posts.scss';
@import 'modules/footer.scss';
@import 'modules/something-else.scss';

Run the following command (from the project folder) in order to build

compass compile . sass/main.scss -s compressed

This just compiles main.scss, which inturn goes and imports each of your modules. Additionally the compressed style option minifies the output.

like image 178
isNaN1247 Avatar answered Nov 10 '22 23:11

isNaN1247