zoukankan      html  css  js  c++  java
  • sass的安装及使用

    打开命令行

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

      连续安装三个麻烦的话,来个快捷的方式

    npm install sass-loader node-sass vue-style-loader --D
    //卸载sass
    npm uninstall --save-dev sass-loader
    npm uninstall --save-dev node-sass

      打开build文件夹下面的webpack.base.config.js,如下修改

    module: {
        rules: [
          ...(config.dev.useEslint ? [createLintingRule()] : []),
          {
            test: /\.vue$/,
            loader: 'vue-loader',
            options: vueLoaderConfig
          },
          {
            test: /\.js$/,
            loader: 'babel-loader',
            include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
          },
          {
            test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: utils.assetsPath('img/[name].[hash:7].[ext]')
            }
          },
          {
            test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: utils.assetsPath('media/[name].[hash:7].[ext]')
            }
          },
          {
            test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
            }
          },
          { //上面的不修改,这是sass的配置
            test: /\.scss$/,
            loaders: ['style', 'css', 'sass']
          }
        ]
      },
    

      在 .vue 的编程页面上,style上加 lang='scss'

           在引入sass文件是sass文件后缀为 .scss 

    代码改变了我们,也改变了世界
  • 相关阅读:
    powerful number 小记
    CF573E Bear and Bowling
    Diary 2.0
    【LOJ2540】「PKUWC2018」随机算法
    【Luogu2496】【BZOJ3005】[SDOI2012]体育课
    CF-diary
    【CF1217F】Forced Online Queries Problem
    NOI2019 选做
    Codeforces Round #568 (Div. 2) 选做
    【LOJ2513】「BJOI2018」治疗之雨
  • 原文地址:https://www.cnblogs.com/wencaiguagua/p/15619823.html
Copyright © 2011-2022 走看看