You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-13
Original file line number
Diff line number
Diff line change
@@ -48,16 +48,12 @@ This allows you to control the versions of all your dependencies, and to choose
48
48
49
49
> [!NOTE]
50
50
>
51
-
> We highly recommend using [Dart Sass](https://github.com/sass/dart-sass).
51
+
> We highly recommend using [Sass Embedded](https://github.com/sass/embedded-host-node) or [Dart Sass](https://github.com/sass/dart-sass).
52
52
53
53
> [!WARNING]
54
54
>
55
55
> [Node Sass](https://github.com/sass/node-sass) does not work with [Yarn PnP](https://classic.yarnpkg.com/en/docs/pnp/) and doesn't support [@use rule](https://sass-lang.com/documentation/at-rules/use).
56
56
57
-
> [!WARNING]
58
-
>
59
-
> [Sass Embedded](https://github.com/sass/embedded-host-node) is experimental and in `beta`, therefore some features may not work
60
-
61
57
Chain the `sass-loader` with the [css-loader](https://github.com/webpack-contrib/css-loader) and the [style-loader](https://github.com/webpack-contrib/style-loader) to immediately apply all styles to the DOM or the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) to extract it into a separate file.
62
58
63
59
Then add the loader to your webpack configuration. For example:
@@ -164,8 +160,8 @@ Default: `sass`
164
160
165
161
The special `implementation` option determines which implementation of Sass to use.
166
162
167
-
By default, the loader resolve the implementation based on your dependencies.
168
-
Just add the desired implementation to your `package.json` (`sass` or `node-sass` package) and install dependencies.
163
+
By default, the loader resolves the implementation based on your dependencies.
164
+
Just add the desired implementation to your `package.json` (`sass`, `sass-embedded`, or `node-sass` package) and install dependencies.
169
165
170
166
Example where the `sass-loader` loader uses the `sass` (`dart-sass`) implementation:
171
167
@@ -193,14 +189,38 @@ Example where the `sass-loader` loader uses the `node-sass` implementation:
193
189
}
194
190
```
195
191
196
-
Beware the situation where both `node-sass` and `sass` are installed! By default, the `sass-loader` prefers `sass`.
197
-
In order to avoid this situation you can use the `implementation` option.
192
+
Example where the `sass-loader` loader uses the `sass-embedded` implementation:
198
193
199
-
The `implementation` options either accepts `sass` (`Dart Sass`) or `node-sass` as a module.
194
+
**package.json**
195
+
196
+
```json
197
+
{
198
+
"devDependencies": {
199
+
"sass-loader": "^7.2.0",
200
+
"sass": "^1.22.10"
201
+
},
202
+
"optionalDependencies": {
203
+
"sass-embedded": "^1.70.0"
204
+
}
205
+
}
206
+
```
207
+
208
+
> [!NOTE]
209
+
>
210
+
> Using `optionalDependencies` means that `sass-loader` can fallback to `sass`
211
+
> when running on an operating system not supported by `sass-embedded`
212
+
213
+
Be aware of the order that `sass-loader` will resolve the implementation:
214
+
215
+
1.`sass-embedded`
216
+
2.`sass`
217
+
3.`node-sass`
218
+
219
+
You can specify a specific implementation by using the `implementation` option, which accepts one of the above values.
200
220
201
221
#### `object`
202
222
203
-
For example, to use Dart Sass, you'd pass:
223
+
For example, to always use Dart Sass, you'd pass:
204
224
205
225
```js
206
226
module.exports= {
@@ -214,7 +234,7 @@ module.exports = {
214
234
{
215
235
loader:"sass-loader",
216
236
options: {
217
-
// Prefer `dart-sass`
237
+
// Prefer `dart-sass`, even if `sass-embedded` is available
218
238
implementation:require("sass"),
219
239
},
220
240
},
@@ -241,7 +261,7 @@ module.exports = {
241
261
{
242
262
loader:"sass-loader",
243
263
options: {
244
-
// Prefer `dart-sass`
264
+
// Prefer `dart-sass`, even if `sass-embedded` is available
0 commit comments