vue中使用scss

270 阅读1分钟

一、安装

  • npm install node-sass sass-loader style-loader -D
  • 版本
    "node-sass": "^4.7.2",
    "sass-loader": "^6.0.6",
    "style-loader": "^3.3.1",

二、添加配置

  • 修改webpack.base.conf.js配置文件rules
rules: [
         {
           test: /\.scss?$/,
           loaders: ['style','css','sass']
         }
       ]

三、vue模板中使用

<style lang="scss" scoped>
.inputBox{
  width: 200px;
  input{
    height: 28px;
  }
}
</style>