Skip to content

Commit 636ecc6

Browse files
committed
docs: add style include paths docs
This feature was introduce in angular#4003 but never documented.
1 parent 9b70fda commit 636ecc6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/documentation/stories/global-styles.md

+24
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,27 @@ You can also rename the output and lazy load it by using the object format:
2626
{ "input": "pre-rename-style.scss", "output": "renamed-style" },
2727
],
2828
```
29+
30+
In Sass and Stylus you can also make use of the `includePaths` functionality for both component and
31+
global styles, which allows you to add extra base paths that will be checked for imports.
32+
33+
To add paths, use the `stylePreprocessorOptions` entry in angular-cli.json `app` object:
34+
35+
```
36+
"stylePreprocessorOptions": {
37+
"includePaths": [
38+
"style-paths"
39+
]
40+
},
41+
```
42+
43+
Files in that folder, e.g. `src/style-paths/_variables.scss`, can be imported from anywhere in your
44+
project without the need for a relative path:
45+
46+
```
47+
// src/app/app.component.scss
48+
// A relative path works
49+
@import '../style-paths/variables';
50+
// But now this works as well
51+
@import 'variables';
52+
```

0 commit comments

Comments
 (0)