码迷,mamicode.com
首页 > 其他好文 > 详细

vue-cli sass安装

时间:2018-03-10 16:07:17      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:flex   url   get   off   安装   nbsp   pre   style   --   

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

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

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

rules: [
      {
        test: /\.vue$/,
        loader: ‘vue-loader‘,
        options: vueLoaderConfig
      },
      {
        test: /\.js$/,
        loader: ‘babel-loader‘,
        include: [resolve(‘src‘), resolve(‘test‘)]
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: ‘url-loader‘,
        query: {
          limit: 10000,
          name: utils.assetsPath(‘img/[name].[hash:7].[ext]‘)
        }
      },
      {
        test: /\.scss$/,
        loaders: ["style", "css", "sass"]
      },
      {
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        loader: ‘url-loader‘,
        query: {
          limit: 10000,
          name: utils.assetsPath(‘fonts/[name].[hash:7].[ext]‘)
        }
      }
    ]
  }

三、在.vue文件中

<style lang="scss" type="text/css">
    @import url(‘common/css/reset.css‘);

    $vw_base: 375; 
    @function vw($px) {
        @return ($px / 375) * 100vw;
    }

    .main {
        display: flex;
        width: vw(50);
    }
</style>

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

vue-cli sass安装

标签:flex   url   get   off   安装   nbsp   pre   style   --   

原文地址:https://www.cnblogs.com/sorrowx/p/8538884.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!