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?

Community
  • 1
  • 1
Frederik Struck-Schøning
  • 12,981
  • 8
  • 59
  • 68
  • 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 '12 at 15:43
  • @cimmanon If he doesn't mind they being imported alphabetically, he could use the [Sass Globbing Plugin](https://github.com/chriseppstein/sass-globbing). – bookcasey Dec 21 '12 at 04: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. – Frederik Struck-Schøning Jul 24 '13 at 09:41

1 Answers1

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.

bookcasey
  • 39,223
  • 13
  • 77
  • 94
  • 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 '14 at 11:37