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?
Fundamentally both rules do the same thing - load members inside another module. The main differences is how they handle members. @import makes everything globally accessible in the target file.
Sass Partials scss files directly. However, when you want to import a file, you do not need the file to be transpiled directly. Sass has a mechanism for this: If you start the filename with an underscore, Sass will not transpile it. Files named this way are called partials in Sass.
In brief, @import is being replaced with more explicit @use and @forward rules. Over the next few years Sass @import will be deprecated, and then removed. You can still use CSS imports, but they won't be compiled by Sass.
A partial is simply an Sass file preceded by an underscore. An example is _name-of-file. scss . The underscore tells Sass that the file is a partial and that it should not be compiled to CSS.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With