Skip to content

Commit 883edd2

Browse files
authored
docs(readme): improve readability of resolving import at-rules and fix webpack links (#935)
1 parent 0c12b61 commit 883edd2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,15 @@ Thus you can import your Sass modules from `node_modules`.
9191
```
9292

9393
Using `~` is deprecated and can be removed from your code (**we recommend it**), but we still support it for historical reasons.
94-
Why you can remove it? The loader will first try to resolve `@import` as relative, if it cannot be resolved, the loader will try to resolve `@import` inside [`node_modules`](https://webpack.js.org/configuration/resolve/#resolve-modules).
95-
Just prepend them with a `~` which tells webpack to look up the [`modules`](https://webpack.js.org/configuration/resolve/#resolve-modules).
94+
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).
95+
96+
Prepending module paths with a `~` tells webpack to search through [`node_modules`](https://webpack.js.org/configuration/resolve/#resolvemodules).
9697

9798
```scss
9899
@import "~bootstrap";
99100
```
100101

101-
It's important to only prepend it with `~`, because `~/` resolves to the home directory.
102+
It's important to prepend it with only `~`, because `~/` resolves to the home directory.
102103
Webpack needs to distinguish between `bootstrap` and `~bootstrap` because CSS and Sass files have no special syntax for importing relative files.
103104
Writing `@import "style.scss"` is the same as `@import "./style.scss";`
104105

0 commit comments

Comments
 (0)