Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion website/docs/en/plugins/list/plugin-sass.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,17 @@ pluginSass({
- **Default:** `true`
- **Version:** `>= 1.2.0`

Whether to use `resolve-url-loader` to rewrite urls.
Whether to use [resolve-url-loader](https://github.com/bholloway/resolve-url-loader/tree/v5/packages/resolve-url-loader) to rewrite URLs.

When enabled, `resolve-url-loader` allows you to write relative URLs in your Sass files that are correctly resolved from the current Sass file's location, rather than being relative to the Sass entry file (e.g. `main.scss`).

If you set this option to `false`, the build performance will be improved, but Rsbuild will use the native URL resolution of Sass, which means all URLs must be relative to the Sass entry file.

```ts
pluginSass({
rewriteUrls: false,
});
```

## Practices

Expand Down
18 changes: 18 additions & 0 deletions website/docs/zh/plugins/list/plugin-sass.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@ pluginSass({
});
```

### rewriteUrls

- **类型:** `boolean`
- **默认值:** `true`
- **版本:** `>= 1.2.0`

是否使用 [resolve-url-loader](https://github.com/bholloway/resolve-url-loader/tree/v5/packages/resolve-url-loader) 来重写 URL。

当启用时,`resolve-url-loader` 允许你在 Sass 文件中写相对路径的 URL,这些 URL 会被正确地从当前 Sass 文件的位置解析,而不是相对于 Sass 入口文件(例如 `main.scss`)。

如果设置为 `false`,构建性能会得到提升,但 Rsbuild 会使用 Sass 的原生 URL 解析,这意味着所有 URL 必须相对于 Sass 入口文件。

```ts
pluginSass({
rewriteUrls: false,
});
```

## 实践

### 修改 Sass implementation
Expand Down
Loading