Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to import all partial files in SASS?

Tags:

css

sass

I would like to know if it's possible to write just a name of a folder and every file inside would be automatically imported?

For example, I have a main.scss which contains only imports

@import "components/forms";
@import "components/header";
@import 'components/intro';

and I would like to just write

@import "components/**/*";

So every file inside components will be imported as above.

like image 617
Martin Jinda Avatar asked Nov 09 '16 22:11

Martin Jinda


1 Answers

I can use sass-globbing. It lets me import directories or whole directory trees with a single @import statement:

// import a directory's contents
@import 'dir/*';

// recursively import a directory's contents and any sub-directories:
@import 'dir/**/*';

I’ll install it from the command line

gem install sass-globbing

more here on Github plugin homepage.

like image 120
Martin Jinda Avatar answered Sep 21 '22 04:09

Martin Jinda