1

Say for example. Need to import a folder where all your scss partials in there. My query is how will I import the entire directory.

@import'layout/.'; Is this a right way or Correct me if i am wrong.

  • Does this answer your question? [Is it possible to import a whole directory in sass using @import?](https://stackoverflow.com/questions/4778627/is-it-possible-to-import-a-whole-directory-in-sass-using-import) – Kal Jun 11 '21 at 02:31

2 Answers2

2

You can't import a folder SCSS you have to import each file

// Modules and Variables
@import "/base";

// Partials
@import "/reset";
@import "/typography";
@import "/buttons";
@import "/figures";
@import "/grids";
// ...

// Third-party
@import "vendor/colorpicker";
@import "vendor/jquery.ui.core";

Also you can import one file that has already imported everything in the folder. This way you can choose not to import some files.

nolawi
  • 4,439
  • 6
  • 22
  • 45
2

You CAN import all partials within a given directory IF you're either using Ruby-on-Rails or using gulp (from my knowledge). In Gulp there is a plugin called gulp-sass-glob that will enable this to work. It's how I personally do my own imports.

Gerico
  • 5,079
  • 14
  • 44
  • 85
  • there is also a gem install sass-globbing which enables you to use * Wildcards. you do this like `@import "layout/*"` or `@import "layout/**/*"` to include subdirectories. On Windows you have to us `@import "layout**/**"` and I did not find a way to include subdirectories till now. – Lars Jendrzejewski Jan 03 '20 at 15:58