You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the current behavior?
I am trying to implement PostCSS autoprefixer to my project but it doesn't seem to work. After going through the instructions on the PostCSS repo, I still have no luck so was hoping someone can assist. I have followed the steps as below
postcss-loader installed through npm
webpack.common.js snippet as below
module: {
rules: [
/*
* to string and css loader support for *.css files
* Returns file content as string
*
*/
{
test: /\.css$/,
use: ['to-string-loader', 'css-loader', 'postcss-loader']
},
// support for .scss files
// use 'null' loader in test mode (https://github.com/webpack/null-loader)
// all css in src/style will be bundled in an external css file
{
test: /\.(scss|sass)$/,
exclude: /node_modules/,
loaders: ['raw-loader', 'postcss-loader', 'sass-loader']
},
],
}
I have created a postcssconfig.js with the following plugins
Just found: every config i.e. webpack.dev.js, webpack.prod.js, webpack.test.js overrides (s)css rules from webpack.common.js so 'postcss-loader' SHOULD BE ADDED INTO EVERY CONFIG.
Activity
six006 commentedon Dec 26, 2016
1.npm install autoprefixer
const autoprefixer = require('autoprefixer');
2.add some
{
test: /.scss$/,
exclude: /node_modules/,
use: [
{
loader: 'raw-loader'
},
{
loader: 'postcss-loader',
options: {
sourceMap: true,
plugins: () => [autoprefixer({ browsers: ['iOS >= 7', 'Android >= 4.1'] }), rpx2rem()],
},
},
3.full text
katallaxie commentedon Jan 1, 2017
@six006 seems to be sufficient. If more is needed add it to the wiki.
bobrosoft commentedon Apr 11, 2017
Just found: every config i.e. webpack.dev.js, webpack.prod.js, webpack.test.js overrides (s)css rules from webpack.common.js so 'postcss-loader' SHOULD BE ADDED INTO EVERY CONFIG.