sass-package-importer
A node-sass importer to resolve files from either npm packages or relative paths
const render = ;const sassPackageImporter = ; // ./relative.css: .title { color: green; } const data = `@import 'normalize.css';@import 'relative';`; // `relative` is resolved but `normalize.css` is not resolved; // `normalize.css` is resolved and the rendered CSS includes contents of normalize.css;
Installation
npm install sass-package-importer
API
const sassPackageImporter = ;
sassPackageImporter
Type: Function
Once this function is passed to importer
option of node-sass's render
method, it checks if each @import
target can be resolved with require.resolve()
.
If a target is resolvable and is neither JavaScript nor JSON file, the @import
will be inlined with the stylesheet in the resolved npm package. Otherwise @import
is treated as usual.
License
ISC License © 2018 Shinnosuke Watanabe