Skip to content
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
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

Wraps CSS in named cascade layers. What CSS is wrapped in which layer is defined using glob patterns supported by minimatch package. Note that it is also possible to exclude paths using glob patterns (see advanced use case). Layer order is derived from order in which layers are defined.

## Why CSS Cascade Layers?

CSS Cascade Layers provide a way to organize CSS with explicit specificity control:

- **Better organization** - Group related styles together
- **Specificity control** - Layer order determines precedence, not specificity
- **Easier overrides** - Later layers override earlier ones, regardless of selector specificity
- **Framework integration** - Cleanly separate third-party, base, component, and utility styles

Learn more: [MDN: CSS Cascade Layers](https://developer.mozilla.org/en-US/docs/Web/CSS/@layer)

## Getting Started

To begin, you'll need to install `css-layering-webpack-plugin`:
Expand Down Expand Up @@ -121,6 +132,17 @@ module.exports = {
>
> You can inject preexisting named layers into layer order by specifying a layer without `path`

## Migrating from pre-TypeScript versions (< 0.3.0)

The plugin export changed from a **default export** to a **named export**. Update your import:

```diff
- const CSSLayeringPlugin = require("css-layering-webpack-plugin");
+ const { CSSLayeringPlugin } = require("css-layering-webpack-plugin");
```

The `path` and `exclude` options now also accept arrays of glob patterns in addition to single strings. Existing single-string configurations continue to work without changes.

## License

[MIT](./LICENSE)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.0",
"version": "1.1.0",
"name": "css-layering-webpack-plugin",
"main": "dist/index.js",
"scripts": {
Expand Down Expand Up @@ -36,7 +36,7 @@
"webpack": "5.97.1"
},
"dependencies": {
"minimatch": "10.0.1"
"minimatch": "10.2.4"
},
"peerDependencies": {
"html-webpack-plugin": ">=5.6.0",
Expand Down
28 changes: 21 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading