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

How to use boost.python to call c++ dynamic library in linux

Preface Recently I started using robot framework ...

How to reset the initial value of the auto-increment column in the MySQL table

How to reset the initial value of the auto-increm...

Robots.txt detailed introduction

Robots.txt is a plain text file in which website ...

MySQL count detailed explanation and function example code

Detailed explanation of mysql count The count fun...

jQuery realizes the effect of theater seat selection and reservation

jQuery realizes the effect of theater seat select...

KVM virtualization installation, deployment and management tutorial

Table of contents 1.kvm deployment 1.1 kvm instal...

Methods and steps for deploying GitLab environment based on Docker

Note: It is recommended that the virtual machine ...

Specific use of Bootstrap5 breakpoints and containers

Table of contents 1. Bootstrap5 breakpoints 1.1 M...

mysql row column conversion sample code

1. Demand We have three tables. We need to classi...

Some problems you may encounter when installing MySQL

Question 1: When entering net start mysql during ...

Example explanation of alarm function in Linux

Introduction to Linux alarm function Above code: ...