我想知道autoprefixer
中我们应该使用lost
,postcssflexibility
,webpack
的顺序?
答案 0 :(得分:1)
Here's a basic example (prefixing through postcss, applying precss plugin etc.).
const autoprefixer = require('autoprefixer');
const precss = require('precss');
module.exports = {
module: {
loaders: [
{
test: /\.css$/,
loaders: ['style', 'css', 'postcss'],
},
],
},
// PostCSS plugins go here
postcss: function () {
return [autoprefixer, precss];
},
};
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
ident: 'postcss', // Needed for now
plugins: function () {
// Set up plugins here
return [
require('autoprefixer'),
require('precss'),
];
},
},
},
],
},
],
},
Another way would be to push the plugins to postcss.config.js as instructed in the postcss-loader documentation. It is more difficult to compose that, though.