Skip to content

Extracts all SASS variables from a file and makes them available as a JS map

Notifications You must be signed in to change notification settings

m10/sass-to-js-var-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SASS to JS variable loader for Webpack

Installation

npm install --save-dev sass-to-js-var-loader

Description

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 occurance).

Example

test.scss

$foo: #f00;
$bar-baz: lighten(#444, 20%);

test.js

var variables = require('sass-to-js-var!./test.scss');

console.log(variables.foo);
console.log(variables.barBaz);

Output

#f00
#777777

About

Extracts all SASS variables from a file and makes them available as a JS map

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%