Skip to content

Instantly share code, notes, and snippets.

@dbismut
Last active December 2, 2015 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbismut/1d4855884d03351af585 to your computer and use it in GitHub Desktop.
Save dbismut/1d4855884d03351af585 to your computer and use it in GitHub Desktop.
Webpack with postcss-cssnext
@import "./variables.import";
.box {
background: var(--yellow);
}
:root {
--yellow: #FFE673;
}
var webpack = require('webpack');
var babelSettings = {
stage: 0
};
if (process.env.NODE_ENV !== 'production' && !process.env.IS_MIRROR) {
babelSettings.plugins = ['react-transform'];
babelSettings.extra = {
'react-transform': {
transforms: [{
transform: 'react-transform-hmr',
imports: ['react'],
locals: ['module']
}, {
transform: 'react-transform-catch-errors',
imports: ['react', 'redbox-react']
}]
}
};
}
module.exports = {
entry: './entry',
module: {
loaders: [
{
test: /\.css$/,
loader: 'style!css?module&localIdentName=[name]__[local]__[hash:base64:5]!postcss'
}
]
},
postcss: function () {
return [
require('postcss-import')({
addDependencyTo: webpack
}),
require('postcss-cssnext'),
require('postcss-at2x')
];
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment