> For the complete documentation index, see [llms.txt](https://sugar-at.gitbook.io/blog-article/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sugar-at.gitbook.io/blog-article/webpack/sass.md).

# 4. 加载sass

## 1.安装    sass-loader 与   node-sass

```
npm install sass-loader node-sass --save-dev
```

## 2.配置webpack.config.js

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

## 3. 使用方法

index.js

```javascript
import "./../sass/index.scss"
```
