Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem of using less in vue

Shulou Source: shulou.com Published: 2022-06-02 15:26:26 09月11日 Update

The editor will share with you how to solve the problem of using less in vue. I hope you will get something after reading this article. Let's discuss it together.

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

two。 Modify the webpack.base.config.js file, configure the loader load dependency to support external less, and add

/ / in the console, the label style displays the style tag style {test: /\ .less $/, loader: "style tag style {sourceMap: true} / / you can see which less file the current tag style comes from in the console.

3. Use in a project

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

Problems encountered:

Reason: the version of less-loader installed is too high

Solution:

1.npm uninstall less-loader2.npm install less-loader@5.0.0

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

After reading this article, I believe you have a certain understanding of "how to solve the problem of using less in vue". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Tags: Documents tags problems styles console version articles controls code reasons available in finished solutions methods more knowledge industry solutions information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MySQL Huawei Apple MariaDB