Like the vant component library to customize the global style problem in the vue-cli creation project (modify var.css)

< H2 > previously on < / H2 >
  • there is a difference in color between the design style and the vant style
  • so you need to redefine the default style of vant
< H2 > current practice < / H2 >
  • File directory structure
    clipboard.png
  • var.css(,vantcopy,)
    clipboard.png
  • base.css
    clipboard.png
  • index.css
    clipboard.png

"css",sass/less,css

less,sass/stylus

  1. css,"css",vscode(,var.css)
  2. css,webpacksass-loadercssloader

  1. vantvant\packages\vant-css\srccss?less?sass?
  2. webpackmain.js./assets/css/index.cssimportcss
    clipboard.png

methods for handling global SASS/SCSS variables in

vue-cli@3
12:01:24 on September 6, 2020

-two mainstream methods of sharp:
  • use ide/pre-processors.html-sharpsass css: { loaderOptions: { sass: { // webpack.docschina.org/loaders/sass-loader/-sharpoptions // webpack.docschina.org/loaders/sass-loader/-sharpadditionaldata // cli.vuejs.org/guide/css.html-sharppassing-options-to-pre-processor-loaders additionalData: '@import "~@/style/variables.scss";' } } }, }
-sharp Note
  • vue.config.js

    // vue.config.js
    
    module.exports = {
      // sass-loader
      // https://vue-loader.vuejs.org/zh/guide/pre-processors.html-sharpsass
      css: {
        loaderOptions: {
          sass: {
            // webpack.docschina.org/loaders/sass-loader/-sharpoptions
            // webpack.docschina.org/loaders/sass-loader/-sharpadditionaldata
            // cli.vuejs.org/guide/css.html-sharppassing-options-to-pre-processor-loaders
            additionalData: '@import "~@/style/variables.scss";'
          }
        }
      },
    }
  • -sharp Note Meaning:
    • after introducing variables.scss into vue.config.js , Do not introduce it in main.js . Otherwise SassError: An @ import loop has been found:
    -sharp reference:

    https://www.youzanyun.com/zan.
    official documentation gives the first way to feel better.
    feels that if the style of the design draft is different from that of vant, it is not suitable


    is postcss

    .
    MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
    MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bef847-31c93.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
    MySQL Errno : 1021
    Message : Disk full (/tmp/#sql-temptable-64f5-1bef847-31c93.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
    Need Help?