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

I would like to know if it is possible to write only the name of the folder and each file inside will be automatically imported?

For example, I have main.scss which contains only import

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

and I would just like to write

 @import "components/**/*"; 

Thus, each file inside components will be imported, as indicated above.

+6
source share
1 answer

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

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

Extract it from the command line

 gem install sass-globbing 

more details here on the main page of the Github plugin .

+3
source

Source: https://habr.com/ru/post/1012192/


All Articles