Skip to content

Commit af9e115

Browse files
authored
feat: add optional quietDeps and silenceDeprecations config options (#600)
1 parent 1cc5284 commit af9e115

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

readme.md

+25-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import { sass } from '@stencil/sass';
1818

1919
export const config: Config = {
2020
plugins: [
21-
sass()
21+
sass({
22+
// Optional config options
23+
})
2224
]
2325
};
2426
```
@@ -51,6 +53,27 @@ exports.config = {
5153
Note that each of these files are always added to each component, so in most cases they shouldn't contain CSS because it'll get duplicated in each component. Instead, `injectGlobalPaths` should only be used for Sass variables, mixins and functions, but does not contain any CSS.
5254

5355

56+
### Warning Controls
57+
58+
To control and suppress different types of Sass warnings you can use the following options:
59+
60+
- `quietDeps`: Silences warnings from dependencies (files loaded through `loadPaths` or `importers`)
61+
- `silenceDeprecations`: Silences specific deprecation warnings by their identifiers (e.g., 'import' for @import rule warnings)
62+
63+
```js
64+
exports.config = {
65+
plugins: [
66+
sass({
67+
// Silence all dependency warnings
68+
quietDeps: true,
69+
// Silence specific deprecation warnings
70+
silenceDeprecations: ['import']
71+
})
72+
]
73+
};
74+
```
75+
76+
5477
## Related
5578

5679
* [sass](https://www.npmjs.com/package/sass)
@@ -62,4 +85,4 @@ Note that each of these files are always added to each component, so in most cas
6285

6386
## Contributing
6487

65-
Please see our [Contributor Code of Conduct](https://github.com/stenciljs/.github/blob/main/CODE_OF_CONDUCT.md) for information on our rules of conduct.
88+
Please see our [Contributor Code of Conduct](https://github.com/stenciljs/.github/blob/main/CODE_OF_CONDUCT.md) for information on our rules of conduct.

src/declarations.ts

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { DeprecationOrId } from 'sass-embedded';
2+
13
export * from '@stencil/core/internal';
24

35
export interface PluginOptions {
@@ -73,6 +75,19 @@ export interface PluginOptions {
7375
*/
7476
outputStyle?: 'compressed' | 'expanded';
7577

78+
/**
79+
* If true, Sass won't print warnings that are caused by dependencies.
80+
* A "dependency" is defined as any file that's loaded through loadPaths or importers.
81+
* Stylesheets that are imported relative to the entrypoint are not considered dependencies.
82+
*/
83+
quietDeps?: boolean;
84+
85+
/**
86+
* If true, Sass won't print warnings that are caused by deprecated features.
87+
* @see: https://sass-lang.com/documentation/js-api/interfaces/stringoptions/#silenceDeprecations
88+
*/
89+
silenceDeprecations?: DeprecationOrId[];
90+
7691
/**
7792
* Enables the outputting of a source map.
7893
*/

0 commit comments

Comments
 (0)