11

In a compass/sass setup, ideally I would like to compile every .scss-file into one big style.css. Looking e.g. here, it seems my only option would be to make _partials.scss and @import "these"; from one main file. This seems like double work, since every time I move around a .scss-file e.g. to a sub folder I have to update the referenced import-path.

My question is: is it possible with compass instead to just watch a folder and always compile all partials into one single target output file?

3
  • 4
    How would Sass know what order to include the files? Order impacts the cascade, and mixins have to be defined before they can be used.
    – cimmanon
    Dec 19, 2012 at 15:43
  • @cimmanon If he doesn't mind they being imported alphabetically, he could use the Sass Globbing Plugin.
    – bookcasey
    Dec 21, 2012 at 4:45
  • Good point, @cimmanon, that obviously this could mess up cascading that relies on rule order. Most cases, though, ensuring that mixins are loaded first (e.g. through prefixing files with double-underscore or the like) would suffice. Thanks y'all. Jul 24, 2013 at 9:41

1 Answer 1

12

Use the Sass Globbing Plugin.

This way you can import an entire folder:

@import "library/partials/*"

The partials will be sorted alphabetically before being imported.

1
  • 2
    it seems it has problems with windows, and also it's not full compatible with GULP right now (see issues page)
    – vsync
    Mar 23, 2014 at 11:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.