Skip to content

Commit f2467ac

Browse files
authored
docs: improve the grammar of the readme (#1212)
* 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
1 parent 189196a commit f2467ac

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

README.md

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ This allows you to control the versions of all your dependencies, and to choose
5252
5353
> [!WARNING]
5454
>
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).
5656
5757
> [!WARNING]
5858
>
5959
> [Sass Embedded](https://github.com/sass/embedded-host-node) is experimental and in `beta`, therefore some features may not work
6060
6161
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.
6262

63-
Then add the loader to your Webpack configuration. For example:
63+
Then add the loader to your webpack configuration. For example:
6464

6565
**app.js**
6666

@@ -110,14 +110,13 @@ For `production` mode, the `outputStyle` (old API) and `style` (new API) options
110110

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

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`.
115114

116115
```scss
117116
@import "bootstrap";
118117
```
119118

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.
121120
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).
122121

123122
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
126125
@import "~bootstrap";
127126
```
128127

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.
130129
Webpack needs to distinguish between `bootstrap` and `~bootstrap` because CSS and Sass files have no special syntax for importing relative files.
131130
Writing `@import "style.scss"` is the same as `@import "./style.scss";`
132131

@@ -137,9 +136,9 @@ Since Sass implementations don't provide [url rewriting](https://github.com/sass
137136
- If you pass the generated CSS on to the `css-loader`, all urls must be relative to the entry-file (e.g. `main.scss`).
138137
- If you're just generating CSS without passing it to the `css-loader`, it must be relative to your web root.
139138

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).
141140

142-
Thankfully there are a two solutions to this problem:
141+
Thankfully there are two solutions to this problem:
143142

144143
- 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.
145144
- 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`
165164

166165
The special `implementation` option determines which implementation of Sass to use.
167166

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.
170169

171170
Example where the `sass-loader` loader uses the `sass` (`dart-sass`) implementation:
172171

@@ -194,7 +193,7 @@ Example where the `sass-loader` loader uses the `node-sass` implementation:
194193
}
195194
```
196195

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`.
198197
In order to avoid this situation you can use the `implementation` option.
199198

200199
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
273272

274273
> [!NOTE]
275274
>
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`.
277276
278277
> [!NOTE]
279278
>
280-
> The `indentedSyntax` option has `true` value for the `sass` extension.
279+
> The `indentedSyntax` option is `true` for the `sass` extension.
281280
282281
> [!NOTE]
283282
>
284283
> Options such as `data` and `file` are unavailable and will be ignored.
285284
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`.
287286
288287
> [!NOTE]
289288
>
290289
> 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.
291290
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`.
293292

294-
Please consult documentation before using them:
293+
Please consult their respective documentation before using them:
295294

296295
- [Dart Sass documentation](https://sass-lang.com/documentation/js-api/interfaces/Options) for all available `sass` options.
297296
- [Node Sass documentation](https://github.com/sass/node-sass/#options) for all available `node-sass` options.
@@ -329,7 +328,7 @@ module.exports = {
329328

330329
#### `function`
331330

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.
333332

334333
```js
335334
module.exports = {
@@ -380,9 +379,9 @@ Default: depends on the `compiler.devtool` value
380379
Enables/Disables generation of source maps.
381380

382381
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`.
384383

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.
386385
387386
**webpack.config.js**
388387

@@ -414,8 +413,8 @@ module.exports = {
414413
```
415414

416415
> ℹ 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`.
419418
420419
**webpack.config.js**
421420

@@ -565,10 +564,10 @@ type webpackImporter = boolean;
565564

566565
Default: `true`
567566

568-
Enables/Disables the default Webpack importer.
567+
Enables/Disables the default webpack importer.
569568

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)).
572571

573572
**webpack.config.js**
574573

@@ -628,7 +627,7 @@ $known-prefixes: webkit, moz, ms, o;
628627
}
629628
```
630629

631-
The presented code will throw webpack warning instead logging.
630+
The presented code will throw a webpack warning instead logging.
632631

633632
To ignore unnecessary warnings you can use the [ignoreWarnings](https://webpack.js.org/configuration/other-options/#ignorewarnings) option.
634633

@@ -666,15 +665,15 @@ type api = "legacy" | "modern" | "modern-compiler";
666665

667666
Default: `"legacy"`
668667

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).
670669

671670
> [!NOTE]
672671
>
673672
> 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.
674673
675674
> [!WARNING]
676675
>
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.
678677
679678
**webpack.config.js**
680679

@@ -705,8 +704,8 @@ module.exports = {
705704

706705
## How to enable `@debug` output
707706

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:
710709

711710
```js
712711
module.exports = {
@@ -721,9 +720,9 @@ module.exports = {
721720

722721
### Extracts CSS into separate files
723722

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.
725724

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:
727726

728727
#### 1. [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin)
729728

@@ -789,7 +788,7 @@ module.exports = {
789788

790789
#### 3. [extract-loader](https://github.com/peerigon/extract-loader) (simpler, but specialized on the css-loader's output)
791790

792-
#### 4. [file-loader](https://github.com/webpack-contrib/file-loader) (deprecated--should only be used in Webpack v4)
791+
#### 4. [file-loader](https://github.com/webpack-contrib/file-loader) (deprecated--should only be used in webpack v4)
793792

794793
**webpack.config.js**
795794

@@ -825,7 +824,7 @@ module.exports = {
825824

826825
Enables/Disables generation of source maps.
827826

828-
To enable CSS source maps, you'll need to pass the `sourceMap` option to the `sass-loader` _and_ the css-loader.
827+
To enable CSS source maps, you'll need to pass the `sourceMap` option to the `sass-loader` _and_ the `css-loader`.
829828

830829
**webpack.config.js**
831830

0 commit comments

Comments
 (0)