zoukankan      html  css  js  c++  java
  • vue scss 安装

    1、开始在vue项目中使用sass,在命令行输入一下命令进行安装(使用git命令行要用shift+insert 进行粘贴否则粘贴不上)

    cnpm install node-sass --save-dev //安装node-sass 
    cnpm install sass-loader --save-dev //安装sass-loader
    cnpm install style-loader --save-dev //安装style-loader 有些人安装的是 vue-style-loader 其实是一样的!

    2. 这个时候你打开build文件夹下面的webpack.base.config.js
    把里面的module改成这样的

    module: { 
        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',
                 options: {
                    limit: 10000,
                    name: utils.assetsPath('img/[name].[hash:7].[ext]')
    }
    },
              {
    test: /.(woff2?|eot|ttf|otf)(?.*)?$/,
    loader: 'url-loader',
    options: {
    limit: 10000,
    name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
    }
    },
              { //添加下面这段代码
    test: /.scss$/,
    loaders: ["style", "css", "sass"]
    }
    ]
    }
    3.在需要用到sass的地方添加lang=scss

    <style lang="scss" scoped="" type="text/css"> 
    //你的sass语言 $primary-color: #333;
    body {
    color: $primary-color; //编译后就成了 color:#333;类似于js的变量!
    }
    </style>
  • 相关阅读:
    org.hibernate.HibernateException: Could not obtain transactionsynchronized Session for current thread
    ajax上传文件
    iphone 图层操作
    什么是OAuth授权
    UIWebView得到加载页的title
    转iphone 动画实现方法
    c#字符串转datatime时,因操作系统不一致产生的问题解决方法
    Bold font in IPhone UILabel
    五种开源协议的比较(BSD,Apache,GPL,LGPL,MIT)
    包含iphone4在内的icon,default及图片处理方法
  • 原文地址:https://www.cnblogs.com/whlBooK/p/10579839.html
Copyright © 2011-2022 走看看