Skip to content

SASS/SCSS Import function to import files from node_modules

License

Notifications You must be signed in to change notification settings

indexzero/sass-import-modules

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SASS import modules

Version npmBuild StatusDependenciesCoverage Status

SASS/SCSS helper function to import modules or files from node_modules without the need to specify full paths. For example, @import "node_modules/test/file.scss"; will become @import "test/file";. The order of resolvers is configurable, e.g. partials can be given priority over node_modules.

Install

npm install --save sass-import-modules

Usage

node-sass

If your using node-sass programmatically, add the importer to options.

import importer from 'sass-import-modules';

sass.render({
  importer: importer(/* { options } */)
}, (error, result) => {
  // node-sass output
})
WebPack

Add the importer to the sassLoader options.

import importer from 'sass-import-modules';

module.exports = {
  sassLoader: {
    importer: importer(/* { options } */)
  }
}

Options

The following options are supported, provide them as object to the importer:

  import importer from 'sass-import-modules';

  importer(/* { options } */);
  • ext file extension, i.e .scss, .sass, scss or sass (default: .scss).
  • resolvers order of and set of resolvers to use, i.e. local, node, partial (default: ['local', 'node']).
  • paths additional lookup paths, should be absolute.

License

MIT

About

SASS/SCSS Import function to import files from node_modules

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.4%
  • CSS 0.6%