Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update #1242

Merged
merged 1 commit into from
Oct 21, 2024
Merged
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
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ module.exports = {

Finally run `webpack` via your preferred method.

### The `outputStyle` (old API) and `style` (new API) options in `production` mode
### The `style` (new API, by default since 16 version) and `outputStyle` (old API) options in `production` mode

For `production` mode, the `outputStyle` (old API) and `style` (new API) options default to `compressed` unless otherwise specified in `sassOptions`.
For `production` mode, the `style` (new API, by default since 16 version) and `outputStyle` (old API) options default to `compressed` unless otherwise specified in `sassOptions`.

### Resolving `import` at-rules
### Resolving `import` and `use` at-rules

Webpack provides an [advanced mechanism to resolve files](https://webpack.js.org/concepts/module-resolution/).

Expand Down Expand Up @@ -296,13 +296,13 @@ Options for [Dart Sass](http://sass-lang.com/dart-sass) or [Node Sass](https://g

> [!NOTE]
>
> The `indentedSyntax` option is `true` for the `sass` extension.
> The `syntax` (new API, by default since 16 version)`and`indentedSyntax`(old API) option is`scss`for the`scss`extension,`indented`for the`sass`extension and`css`for the`css` extension.

> [!NOTE]
>
> Options such as `data` and `file` are unavailable and will be ignored.

> ℹ We strongly discourage changing the `outFile`, `sourceMapContents`, `sourceMapEmbed`, and `sourceMapRoot` options because `sass-loader` sets these automatically when the `sourceMap` option is `true`.
> ℹ We strongly discourage changing the `sourceMap` (new API, by default since 16 version), `outFile` (old API), `sourceMapContents` (old API), `sourceMapEmbed` (old API), and `sourceMapRoot` (old API) options because `sass-loader` sets these automatically when the `sourceMap` option is `true`.

> [!NOTE]
>
Expand All @@ -313,7 +313,9 @@ There is a slight difference between the options for `sass` (`dart-sass`) and `n
Please consult their respective documentation before using them:

- [Dart Sass documentation](https://sass-lang.com/documentation/js-api/interfaces/Options) for all available `sass` options.
- [Sass Embedded documentation](https://github.com/sass/embedded-host-node) for all available `sass` options.
- [Node Sass documentation](https://github.com/sass/node-sass/#options) for all available `node-sass` options.
- [Sass Embedded documentation](https://github.com/sass/embedded-host-node) for all available `sass` options.

#### `object`

Expand All @@ -334,8 +336,8 @@ module.exports = {
loader: "sass-loader",
options: {
sassOptions: {
indentWidth: 4,
includePaths: ["absolute/path/a", "absolute/path/b"],
style: `compressed`,
loadPaths: ["absolute/path/a", "absolute/path/b"],
},
},
},
Expand Down Expand Up @@ -369,12 +371,12 @@ module.exports = {

if (relativePath === "styles/foo.scss") {
return {
includePaths: ["absolute/path/c", "absolute/path/d"],
loadPaths: ["absolute/path/c", "absolute/path/d"],
};
}

return {
includePaths: ["absolute/path/a", "absolute/path/b"],
loadPaths: ["absolute/path/a", "absolute/path/b"],
};
},
},
Expand All @@ -401,7 +403,7 @@ Enables/Disables generation of source maps.
By default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/) option.
All values enable source map generation except `eval` and `false`.

> ℹ If `true`, the `sourceMap`, `sourceMapRoot`, `sourceMapEmbed`, `sourceMapContents` and `omitSourceMapUrl` options from `sassOptions` will be ignored.
> ℹ If `true`, the `sourceMap` (new API, by default since 16 version), `outFile` (old API), `sourceMapContents` (old API), `sourceMapEmbed` (old API), and `sourceMapRoot` (old API) from `sassOptions` will be ignored.

**webpack.config.js**

Expand Down Expand Up @@ -683,7 +685,7 @@ Type:
type api = "legacy" | "modern" | "modern-compiler";
```

Default: `"modern"` for `sass` (`dart-sass`) and `sass-embedded` or `"legacy"` for `node-sass`
Default: `"modern"` for `sass` (`dart-sass`) and `sass-embedded`, or `"legacy"` for `node-sass`

Allows you to switch between the `legacy` and `modern` APIs. You can find more information [here](https://sass-lang.com/documentation/js-api). The `modern-compiler` option enables the modern API with support for [Shared Resources](https://github.com/sass/sass/blob/main/accepted/shared-resources.d.ts.md).

Expand Down
Loading