Skip to content

loick/jsontosass-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

json to sass loader for webpack

Inspired (and forked) from github.com/EdwardIrby/jsontosass-loader

Changes

No path to give, just a json exported from the webpack config. Now we can have an exportable configuration we can use everywhere.

In config.js :

export const vars = {
    colors : {
        'red'   : '#FF0000',
        'green' : '#00FF00',
    }
    grid : {
        'nb-columns'      : 12,
        // Mobile
        'bk-xs'        : '0px',
        'gutter-xs'    : '10px',
        // Tablet
        'bk-sm'        : '760px',
        'gutter-sm'    : '10px',
        // Desktop
        'bk-md'        : '980px',
        'gutter-md'    : '10px',
        // TV
        'bk-lg'        : '1380px',
        'gutter-lg'    : '10px',
    }
}

export default vars

In the webpack conf :

import variables from './config';

And :

loader: ExtractTextPlugin.extract('style', 'css!sass!jsontosass?vars=' + encodeURIComponent(JSON.stringify(variables)))

About

Json-to-Sass variable loader for Webpack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%