Vue2.0 Setting Global Style (Less / Sass and CSS)

Setting a global style for VUE requires a few steps (if it is SASS to change the Less to Sass)

Step: Main.js under the src directory, It is the following code to add the following code

  Require ('! Style-loader! CSS-Loader! Less-loader! ./ Common / Less / Index.less ") [) [COMMON / LESS / INDEX.SSS'  
In Vue1.0 version can be written, but the version 2.0 is not, the error will be reported to resolve the error

Require (‘./ common / less / index.less “)
   Step 2: 
WebPack.Base.conf under the build directory .js configuration module, only need to add two modules under Rules

module.exports = {module: {rules: [{test: /\.less /, loader: ‘style-loader! css-loader! less-loader’}, {test: / \. Css $ /, loader: ‘css-loader! style-loader’,}]}}

  Third steps:  If the prompt error, you may not have the above dependence, you need to add dependencies in the package.json file in the root directory 

Fourth step: Execute commands in the command window, perform installation dependencies


Linux (Ubuntu, Deepin), MAC OS system may prompt permissions to get permissions, only need to get in front Permissions can be

  If you need to use LASS, as long as the LANG attribute is added in Style Ok  

If public files can be more, the entire file is passed Public file link to achieve multiple style file global styles
  About Vue.js learning tutorial, please click on the topic Vue.js component learning tutorial, Vue.js front-end component learning Tutorial for learning.  
The above is all the content of this article, I hope to help everyone, I hope everyone will support Tumi Cloud.
© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment