首页 > 其他 > 详细

vue-cli中配置sass

时间:2017-03-05 16:22:47      阅读:310      评论:0      收藏:0      [点我收藏+]

如何配置sass

一、安装对应依赖node模块:

npm install node-sass --save-dev
npm install sass-loader --save-dev

二、打开webpack.base.config.js在loaders里面加上

 1 rules: [
 2       {
 3         test: /\.vue$/,
 4         loader: vue-loader,
 5         options: vueLoaderConfig
 6       },
 7       {
 8         test: /\.js$/,
 9         loader: babel-loader,
10         include: [resolve(src), resolve(test)]
11       },
12       {
13         test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
14         loader: url-loader,
15         query: {
16           limit: 10000,
17           name: utils.assetsPath(img/[name].[hash:7].[ext])
18         }
19       },
20       {
21         test: /\.scss$/,
22         loaders: ["style", "css", "sass"]
23       },
24       {
25         test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
26         loader: url-loader,
27         query: {
28           limit: 10000,
29           name: utils.assetsPath(fonts/[name].[hash:7].[ext])
30         }
31       }
32     ]
33   }

三、在用scss的地方写上

<style lang="scss" scoped="" type="text/css"></style>

  

vue-cli中配置sass

原文:http://www.cnblogs.com/rainheader/p/6505366.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!