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
* docs: improve the grammar of the readme
* docs: downcase `webpack` when it's not the start of a sentence
* docs: add comma
* docs: remove weird recommendation
Copy file name to clipboardExpand all lines: README.md
+32-33Lines changed: 32 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,15 +52,15 @@ This allows you to control the versions of all your dependencies, and to choose
52
52
53
53
> [!WARNING]
54
54
>
55
-
> [Node Sass](https://github.com/sass/node-sass) does not work with [Yarn PnP](https://classic.yarnpkg.com/en/docs/pnp/)feature and doesn't support [@use rule](https://sass-lang.com/documentation/at-rules/use).
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
57
> [!WARNING]
58
58
>
59
59
> [Sass Embedded](https://github.com/sass/embedded-host-node) is experimental and in `beta`, therefore some features may not work
60
60
61
61
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
62
63
-
Then add the loader to your Webpack configuration. For example:
63
+
Then add the loader to your webpack configuration. For example:
64
64
65
65
**app.js**
66
66
@@ -110,14 +110,13 @@ For `production` mode, the `outputStyle` (old API) and `style` (new API) options
110
110
111
111
Webpack provides an [advanced mechanism to resolve files](https://webpack.js.org/concepts/module-resolution/).
112
112
113
-
The `sass-loader` uses Sass's custom importer feature to pass all queries to the Webpack resolving engine.
114
-
Thus you can import your Sass modules from `node_modules`.
113
+
The `sass-loader` uses Sass's custom importer feature to pass all queries to the webpack resolving engine enabling you to import your Sass modules from `node_modules`.
115
114
116
115
```scss
117
116
@import"bootstrap";
118
117
```
119
118
120
-
Using `~` is deprecated and can be removed from your code (**we recommend it**), but we still support it for historical reasons.
119
+
Using `~` is deprecated and should be removed from your code, but we still support it for historical reasons.
121
120
Why can you remove it? The loader will first try to resolve `@import` as a relative path. If it cannot be resolved, then the loader will try to resolve `@import` inside [`node_modules`](https://webpack.js.org/configuration/resolve/#resolvemodules).
122
121
123
122
Prepending module paths with a `~` tells webpack to search through [`node_modules`](https://webpack.js.org/configuration/resolve/#resolvemodules).
@@ -126,7 +125,7 @@ Prepending module paths with a `~` tells webpack to search through [`node_module
126
125
@import"~bootstrap";
127
126
```
128
127
129
-
It's important to prepend it with only `~`, because `~/` resolves to the home directory.
128
+
It's important to prepend the path with only `~`, because `~/` resolves to the home directory.
130
129
Webpack needs to distinguish between `bootstrap` and `~bootstrap` because CSS and Sass files have no special syntax for importing relative files.
131
130
Writing `@import "style.scss"` is the same as `@import "./style.scss";`
132
131
@@ -137,9 +136,9 @@ Since Sass implementations don't provide [url rewriting](https://github.com/sass
137
136
- If you pass the generated CSS on to the `css-loader`, all urls must be relative to the entry-file (e.g. `main.scss`).
138
137
- If you're just generating CSS without passing it to the `css-loader`, it must be relative to your web root.
139
138
140
-
You will be disrupted by this first issue. It is natural to expect relative references to be resolved against the `.sass`/`.scss` file in which they are specified (like in regular `.css` files).
139
+
You might be surprised by this first issue, as it is natural to expect relative references to be resolved against the `.sass`/`.scss` file in which they are specified (like in regular `.css` files).
141
140
142
-
Thankfully there are a two solutions to this problem:
141
+
Thankfully there are two solutions to this problem:
143
142
144
143
- Add the missing url rewriting using the [resolve-url-loader](https://github.com/bholloway/resolve-url-loader). Place it before `sass-loader` in the loader chain.
145
144
- Library authors usually provide a variable to modify the asset path. [bootstrap-sass](https://github.com/twbs/bootstrap-sass) for example has an `$icon-font-path`.
@@ -165,8 +164,8 @@ Default: `sass`
165
164
166
165
The special `implementation` option determines which implementation of Sass to use.
167
166
168
-
By default the loader resolve the implementation based on your dependencies.
169
-
Just add required implementation to `package.json` (`sass` or `node-sass` package) and install dependencies.
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.
170
169
171
170
Example where the `sass-loader` loader uses the `sass` (`dart-sass`) implementation:
172
171
@@ -194,7 +193,7 @@ Example where the `sass-loader` loader uses the `node-sass` implementation:
194
193
}
195
194
```
196
195
197
-
Beware the situation when `node-sass` and `sass`were installed! By default the `sass-loader` prefers `sass`.
196
+
Beware the situation where both `node-sass` and `sass`are installed! By default, the `sass-loader` prefers `sass`.
198
197
In order to avoid this situation you can use the `implementation` option.
199
198
200
199
The `implementation` options either accepts `sass` (`Dart Sass`) or `node-sass` as a module.
@@ -273,25 +272,25 @@ Options for [Dart Sass](http://sass-lang.com/dart-sass) or [Node Sass](https://g
273
272
274
273
> [!NOTE]
275
274
>
276
-
> The `charset` option has`true`value by default for `dart-sass`, we strongly discourage change value to `false`, because webpack doesn't support files other than `utf-8`.
275
+
> The `charset` option is`true` by default for `dart-sass`, we strongly discourage setting this to `false`, because webpack doesn't support files other than `utf-8`.
277
276
278
277
> [!NOTE]
279
278
>
280
-
> The `indentedSyntax` option has`true` value for the `sass` extension.
279
+
> The `indentedSyntax` option is`true` for the `sass` extension.
281
280
282
281
> [!NOTE]
283
282
>
284
283
> Options such as `data` and `file` are unavailable and will be ignored.
285
284
286
-
> ℹ We strongly discourage change `outFile`, `sourceMapContents`, `sourceMapEmbed`, `sourceMapRoot` options because `sass-loader`automatically sets these options when the `sourceMap` option is `true`.
285
+
> ℹ We strongly discourage changing the `outFile`, `sourceMapContents`, `sourceMapEmbed`, and `sourceMapRoot` options because `sass-loader` sets these automatically when the `sourceMap` option is `true`.
287
286
288
287
> [!NOTE]
289
288
>
290
289
> Access to the [loader context](https://webpack.js.org/api/loaders/#the-loader-context) inside the custom importer can be done using the `this.webpackLoaderContext` property.
291
290
292
-
There is a slight difference between the `sass` (`dart-sass`) and `node-sass` options.
291
+
There is a slight difference between the options for `sass` (`dart-sass`) and `node-sass`.
293
292
294
-
Please consult documentation before using them:
293
+
Please consult their respective documentation before using them:
295
294
296
295
-[Dart Sass documentation](https://sass-lang.com/documentation/js-api/interfaces/Options) for all available `sass` options.
297
296
-[Node Sass documentation](https://github.com/sass/node-sass/#options) for all available `node-sass` options.
@@ -329,7 +328,7 @@ module.exports = {
329
328
330
329
#### `function`
331
330
332
-
Allows to setup the Sass implementation by setting different options based on the loader context.
331
+
Allows configuring the Sass implementation with different options based on the loader context.
333
332
334
333
```js
335
334
module.exports= {
@@ -380,9 +379,9 @@ Default: depends on the `compiler.devtool` value
380
379
Enables/Disables generation of source maps.
381
380
382
381
By default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/) option.
383
-
All values enable source map generation except `eval` and `false` value.
382
+
All values enable source map generation except `eval` and `false`.
384
383
385
-
> ℹ If a `true` the `sourceMap`, `sourceMapRoot`, `sourceMapEmbed`, `sourceMapContents` and `omitSourceMapUrl` from `sassOptions` will be ignored.
384
+
> ℹ If `true`, the `sourceMap`, `sourceMapRoot`, `sourceMapEmbed`, `sourceMapContents` and `omitSourceMapUrl` options from `sassOptions` will be ignored.
386
385
387
386
**webpack.config.js**
388
387
@@ -414,8 +413,8 @@ module.exports = {
414
413
```
415
414
416
415
> ℹ In some rare cases `node-sass` can output invalid source maps (it is a `node-sass` bug).
417
-
418
-
> > In order to avoid this, you can try to update `node-sass` to latest version or you can try to set within `sassOptions` the `outputStyle` option to `compressed`.
416
+
>
417
+
> In order to avoid this, you can try to update `node-sass` to latest version, or you can try to set within `sassOptions` the `outputStyle` option to `compressed`.
419
418
420
419
**webpack.config.js**
421
420
@@ -565,10 +564,10 @@ type webpackImporter = boolean;
565
564
566
565
Default: `true`
567
566
568
-
Enables/Disables the default Webpack importer.
567
+
Enables/Disables the default webpack importer.
569
568
570
-
This can improve performance in some cases. Use it with caution because aliases and `@import` at-rules starting with `~` will not work.
571
-
You can pass own `importer` to solve this (see [`importer docs`](https://github.com/sass/node-sass#importer--v200---experimental)).
569
+
This can improve performance in some cases, though use it with caution because aliases and `@import` at-rules starting with `~` will not work.
570
+
You can pass your own `importer` to solve this (see [`importer docs`](https://github.com/sass/node-sass#importer--v200---experimental)).
The presented code will throw webpack warning instead logging.
630
+
The presented code will throw a webpack warning instead logging.
632
631
633
632
To ignore unnecessary warnings you can use the [ignoreWarnings](https://webpack.js.org/configuration/other-options/#ignorewarnings) option.
634
633
@@ -666,15 +665,15 @@ type api = "legacy" | "modern" | "modern-compiler";
666
665
667
666
Default: `"legacy"`
668
667
669
-
Allows you to switch between `legacy` and `modern`API. 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).
668
+
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).
670
669
671
670
> [!NOTE]
672
671
>
673
672
> Using `modern-compiler` and `sass-embedded` together significantly improve performance and decrease built time. We strongly recommend their use. We will enable them by default in a future major release.
674
673
675
674
> [!WARNING]
676
675
>
677
-
> The sass options are different for `modern` and `old` APIs. Please look at [docs](https://sass-lang.com/documentation/js-api) how to migrate on new options.
676
+
> The sass options are different for the `legacy` and `modern` APIs. Please look at [docs](https://sass-lang.com/documentation/js-api) how to migrate to the modern options.
678
677
679
678
**webpack.config.js**
680
679
@@ -705,8 +704,8 @@ module.exports = {
705
704
706
705
## How to enable `@debug` output
707
706
708
-
Defaults, the output of `@debug` messages is disabled.
709
-
To enable it, add to **webpack.config.js**following:
707
+
By default, the output of `@debug` messages are disabled.
708
+
Add the following to **webpack.config.js**to enable them:
710
709
711
710
```js
712
711
module.exports= {
@@ -721,9 +720,9 @@ module.exports = {
721
720
722
721
### Extracts CSS into separate files
723
722
724
-
For production builds it's recommended to extract the CSS from your bundle being able to use parallel loading of CSS/JS resources later on.
723
+
For production builds it's recommended to extract the CSS from your bundle to be able to use parallel loading of CSS/JS resources later on.
725
724
726
-
There are four possibilities to extract a style sheet from the bundle:
725
+
There are four recommended ways to extract a stylesheet from a bundle:
0 commit comments