Last active
December 2, 2015 09:20
-
-
Save dbismut/1d4855884d03351af585 to your computer and use it in GitHub Desktop.
Webpack with postcss-cssnext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "./variables.import"; | |
.box { | |
background: var(--yellow); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--yellow: #FFE673; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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