@computerrock/node-sass-json-importer
v1.1.0
Published
Custom JSON importer for node-sass
Downloads
5
Keywords
Readme
@computerrock/node-sass-json-importer
Custom JSON importer for node-sass.
Usage
Install package and peer dependencies by running:
$ npm install node-sass @computerrock/node-sass-json-importer --save-dev
node-sass
import sass from 'node-sass';
import jsonImporter from '@computerrock/node-sass-json-importer';
sass.render({
file: '..',
importer: jsonImporter(),
}, function(err, result) {
/*...*/
});
Webpack 2 configuration (sass-loader)
const jsonImporter = require('@computerrock/node-sass-json-importer');
module.exports = {
module: {
rules: [
{
test: /\.(css|scss)$/,
use: [
require.resolve('style-loader'),
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
},
},
{
loader: require.resolve('sass-loader'),
options: {
importer: jsonImporter(),
},
},
],
}
]
}
};