vue中怎么使用scss写样式


  1. 添加 node-sass, css-loader, compass-mixins

  2. 修改 webpack.base.conf.js

    module: {
        [
        ...
        {
            test: /\.scss$/,
            loaders: ['style', 'css', 'sass']
        }, ]
    },
    // 定义 sass 路径
    sassLoader: {
        includePaths: [
            path.resolve(__dirname, '../src/static/scss/'),
            path.resolve(__dirname,
                '../node_modules/compass-mixins/lib/')
        ]
    },
    vue: {
        loaders: utils.cssLoaders()
    }

    示例 webpack.base.conf.js

  3. 愉快的写scss吧


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录