postcss / postcss-simple-vars

PostCSS plugin for Sass-like variables
MIT License
419 stars 35 forks source link

webpack setup #22

Closed eduarddotgg closed 9 years ago

eduarddotgg commented 9 years ago

I don't understand how to setup it with web pack so variable could be imported from custom.js file. Could you please help me?

var vars                    = require('postcss-simple-vars');
var autoprefixer        = require('autoprefixer-core');

var cssVariables = require('./custom.js');

module: {
    loaders: [
        { test: /\.jade$/, loader: "jade" },
        { test: /\.css$/, loader: "style!css!postcss" }
    ]
},
postcss: function () {
    return [
        cssimport({
            onImport: function (files) {
                files.forEach(this.addDependency);
            }.bind(this)
        }),
        autoprefixer, vars(cssVariables)
    ];
}
eduarddotgg commented 9 years ago

it's working now! it was syntax error.