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
+25-3
Original file line number
Diff line number
Diff line change
@@ -33,15 +33,37 @@ Sass options can be passed to the plugin within the stencil config, which are us
33
33
34
34
### Inject Globals Sass Paths
35
35
36
-
The `injectGlobalPaths` config is an array of paths that automatically get added as `@import` declarations to all components. This can be useful to inject Sass variables, mixins and functions to override defaults of external collections. For example, apps can override default Sass variables of [Ionic components](https://www.npmjs.com/package/@ionic/core). Relative paths within `injectGlobalPaths` should be relative to the stencil config file.
36
+
The `injectGlobalPaths` config is an array of paths that automatically get added as imports to all components. This can be useful to inject Sass variables, mixins and functions to override defaults of external collections. For example, apps can override default Sass variables of [Ionic components](https://www.npmjs.com/package/@ionic/core). Relative paths within `injectGlobalPaths` should be relative to the stencil config file.
37
+
38
+
#### v1
39
+
40
+
v1.x of stencil/sass uses sass `@import` syntax to add files listed in the `injectGlobalPaths` option to each stylesheet. Do not use `@use` in your components if using v1 because it is not permitted by sass to have `@import` statements before `@use` statements. Below is an example of using `injectGlobalPaths` in v1.
v2.x of stencil/sass uses sass `@use` syntax to add files listed in `injectGlobalPaths` to each stylesheet. Because the `@use` syntax also supports namespacing by default, the option is now available to customize the namespace. `injectGlobalPaths` can now be an array of TS tuples. The first position is the filepath and the second position is the namespace. There is still the option to only use a string, which will default the namespace to the name of the file. These methods can be combined.
37
58
38
59
```js
39
60
exports.config= {
40
61
plugins: [
41
62
sass({
42
63
injectGlobalPaths: [
43
-
'src/globals/variables.scss',
44
-
'src/globals/mixins.scss'
64
+
['src/global/variables.scss', 'var'], //adds "@use 'src/global/variables.scss' as var" statement
65
+
['src/global/mixins.scss', '*'], //root namespace, no prefix needed to access
66
+
'src/global/animations.scss'//namespace defaults to 'animations'
0 commit comments