vue-cli中安装scss并全局引入scss

安装node-sass、sass-loader、style-loader
cnpm install node-sass --save-dev

cnpm install sass-loader --save-dev

cnpm install style-loader --save-dev

安装sass-resources-loader

cnpm install sass-resources-loader --save-dev

修改build中的utils.js

scss: generateLoaders('sass')

修改成:

scss: generateLoaders('sass').concat(
{
loader: 'sass-resources-loader',
options: {
resources: path.resolve(__dirname, '../src/assets/global.scss')
}
}
)

vue-cli中安装scss并全局引入scss

 

 vue-cli中安装scss并全局引入scss

 

 vue-cli中安装scss并全局引入scss

 

 vue-cli中安装scss并全局引入scss

上一篇:vue中使用scss时报错(Module build failed: TypeError: this.getResolve is not a function at Object.)


下一篇:webpack to package typescript & scss