Reputation: 914
I'm having a manifest stylesheet, where I import all my existing stylesheets. They are then bundled and minimized into a single CSS file.
What I need to do is import all the files from a single folder, but one. That is because I'm using the Bourbon mixin library and the overriding variables have to come before it, but all the other SCSS files after.
Here's what the tree looks like:
- helpers/
- variables.scss
- classes.scss
- mixins.scss
- bundle.scss
What I want to do is this:
bundle.scss:
@import "helpers/variables";
@import "bourbon";
@import "helpers/*-without_variables";
I've already tried importing all files within this folder with helpers/*
, but it imports variables again, and I don't want that.
Upvotes: 2
Views: 2746
Reputation: 68339
No. Sass does not currently have such a feature. Your only option is to only include the files you actually want.
If any of the files you're trying to import imports the file you're trying to exclude, there's nothing you can do other than modify the source files.
If you're using Compass, there is an import-once extension that comes with it by default. This will cover this use case (import the specified file only once), but will not help if you never want to import a specific file under any circumstance.
Import once funtionality is expected to be a feature of Sass 4.0 (see: https://github.com/sass/sass/issues/139)
Upvotes: 3
Reputation: 29932
Yes, there is a plugin for SASS, which prevents duplicate inclusion of SCSS/SASS files: “SASS Import Once”.
When included in a SASS module, sass-import-once will prevent the styles being duplicated if @import is called somewhere else. This is cool because it allows every SASS file to declare its own dependencies. This promotes encapulation and allows modules to standalone if need be.
https://github.com/wilsonpage/sass-import-once
Compass also has some related feature, but I can't remember the name.
Upvotes: 0