SASS/SCSS Import function to import files from node_modules
MIT License
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
.
npm install --save sass-import-modules
Basic support for CLI usage exists
node-sass --importer sass-import-modules test/fixtures/index.scss
If your using node-sass programmatically, add the importer to options.
const { importer } = require('sass-import-modules');
sass.render({
importer: importer(/* { options } */)
}, (error, result) => {
// node-sass output
})
Add the importer to the sassLoader
options.
const { importer } = require('sass-import-modules');
module.exports = {
sassLoader: {
importer: importer(/* { options } */)
}
}
The following options are supported, provide them as object to the importer:
const { importer } = require('sass-import-modules');
importer(/* { options } */);
['.scss']
, ['.sass']
, ['scss']
or ['sass']
(default: ['.scss', '.css']
).['local', 'tilde', 'node', 'partial']
):
local
,tilde
,node
,partial
MIT