Solve the problem of using less in Vue

Solve the problem of using less in Vue

1. Install less dependency: npm install less less-loader --save

2. Modify the webpack.base.config.js file, configure the loader to load dependencies, make it support external less, and add to the original code

// This method displays the style tag style in the console { 
    test: /\.less$/,

    loader: "style-loader!css-loader!less-loader",
 
   options: { sourceMap: true } //You can see in the console which less file the current tag style comes from} 

3. Use in the project

Add lang="less" to the style tag in the vue file to use less in the tag, or import less externally

Problems encountered:

Cause: The installed version of less-loader is too high. Solution:

1.npm uninstall less-loader 2.npm install [email protected]

Or just modify the version number in the package.json file and then npm install

This is the end of this article about the use of less in vue. For more relevant content on the use of vue less, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Solve the problem of using less/sass in Vue and encountering invalid problems during use
  • vue-cli4 uses variables in the global less file to configure operations
  • Vue uses less styles globally, and components use variables defined in the global style file
  • Detailed tutorial on installing and using less in vue cli
  • A detailed tutorial on using less in Vue
  • Example of using vue + less to implement simple skinning function
  • Detailed explanation of referencing jQuery, bootstrap and using sass and less to write CSS in vue-cli

<<:  About the IE label LI text wrapping problem

>>:  Complete steps for deploying confluence with docker

Recommend

MySQL sorting feature details

Table of contents 1. Problem scenario 2. Cause An...

Linux nohup to run programs in the background and view them (nohup and &)

1. Background execution Generally, programs on Li...

Summary of mysqladmin daily management commands under MySQL (must read)

The usage format of the mysqladmin tool is: mysql...

Comprehensive website assessment solution

<br />Sometimes you may be asked questions l...

HTML tag default style arrangement

html, address,blockquote,body, dd, div,dl, dt, fie...

Do you know all 24 methods of JavaScript loop traversal?

Table of contents Preface 1. Array traversal meth...

vue.config.js packaging optimization configuration

The information on Baidu is so diverse that it...

MySQL: mysql functions

1. Built-in functions 1. Mathematical functions r...

MySQL online log library migration example

Let me tell you about a recent case. A game log l...

Mybatis paging plug-in pageHelper detailed explanation and simple example

Mybatis paging plug-in pageHelper detailed explan...

Win10 + Ubuntu20.04 LTS dual system boot interface beautification

Effect display The built-in boot interface is too...