1、配置sass
npm install --save-dev node-sass sass-loader
nuxt.config.js配置如下
build: {
extend(config, { isDev, isClient }) {
const vueLoader = config.module.rules.find((rule) => rule.loader === 'vue-loader');
vueLoader.options.loaders.sass = 'vue-style-loader!css-loader!sass-loader';
}
}
2、配置postcss
npm install --save-dev postcss-nested postcss-responsive-type postcss-hexrgba
nuxt.config.js配置如下
build: {
postcss: [
require('postcss-nested')(),
require('postcss-responsive-type')(),
require('postcss-hexrgba')(),
],
}