0.0.4 • Published 6 years ago
extract-sass-variables-loader v0.0.4
SASS to JS variable loader for Webpack
Installation
npm install --save-dev extract-sass-variables-loader
Description
This is copy of: https://www.npmjs.com/package/sass-to-js-var-loader Referenced version (at least version 0.0.2) contains bug with parsing files with comments, which have '$' character inside.
This simple, stupid loader will find all variables in a SASS file and provide their compiled values in a JS object with the camel-cased variable names as the keys. This can be useful when you need to reference styling information within your JS files (hopefully a fairly rare occurrence).
Example
test.scss
$foo: #f00;
$bar-baz: lighten(#444, 20%);
test.js
var variables = require('extract-sass-variables-loader!./test.scss');
console.log(variables.foo);
console.log(variables.barBaz);
Output
#f00
#777777