Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable quietDeps and silenceDeprecations config options #600

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import { sass } from '@stencil/sass';

export const config: Config = {
plugins: [
sass()
sass({
// Optional config options
})
]
};
```
Expand Down Expand Up @@ -51,6 +53,27 @@ exports.config = {
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.


### Warning Controls

To control and suppress different types of Sass warnings you can use the following options:

- `quietDeps`: Silences warnings from dependencies (files loaded through `loadPaths` or `importers`)
- `silenceDeprecations`: Silences specific deprecation warnings by their identifiers (e.g., 'import' for @import rule warnings)

```js
exports.config = {
plugins: [
sass({
// Silence all dependency warnings
quietDeps: true,
// Silence specific deprecation warnings
silenceDeprecations: ['import']
})
]
};
```


## Related

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

## Contributing

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.
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.
15 changes: 15 additions & 0 deletions src/declarations.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { DeprecationOrId } from 'sass-embedded';

export * from '@stencil/core/internal';

export interface PluginOptions {
Expand Down Expand Up @@ -73,6 +75,19 @@ export interface PluginOptions {
*/
outputStyle?: 'compressed' | 'expanded';

/**
* If true, Sass won't print warnings that are caused by dependencies.
* A "dependency" is defined as any file that's loaded through loadPaths or importers.
* Stylesheets that are imported relative to the entrypoint are not considered dependencies.
*/
quietDeps?: boolean;

/**
* If true, Sass won't print warnings that are caused by deprecated features.
* @see: https://sass-lang.com/documentation/js-api/interfaces/stringoptions/#silenceDeprecations
*/
silenceDeprecations?: DeprecationOrId[];

/**
* Enables the outputting of a source map.
*/
Expand Down