# 3. 加载less

## 1.安装    less-loader 与   less

```
npm install less-loader less --save-dev
```

## 2.配置webpack.config.js

```javascript
module.exports={
    //...code
    module:{
        rules:[
            {
                //匹配规则
                test:/\.less$/,
                //loader加载顺序 不能颠倒
                use: ['style-loader', 'css-loader','less-loader']
            }
        ]
    }
}
```

## 3. 使用方法

index.js

```javascript
import "./../less/index.less"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sugar-at.gitbook.io/blog-article/webpack/less.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
