Skip to content

Commit c343d4b

Browse files
committed
readme update
1 parent 404fbab commit c343d4b

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ An exceptionally fast, thorough and tiny unused-CSS cleaner _(MIT Licensed)_
55
---
66
### Introduction
77

8-
DropCSS is an [exceptionally fast](#performance), thorough and tiny ([~9 KB min](https://github.com/leeoniya/dropcss/tree/master/dist/dropcss.min.js)) unused-CSS cleaner; it takes your HTML and CSS as input and returns only the used CSS as output. Its custom HTML and CSS parsers are highly optimized for the 99% use case and thus avoid the overhead of handling malformed markup or stylesheets, so you must provide well-formed input. There is minimal handling for complex escaping rules, so there will always exist cases of valid input that cannot be processed by DropCSS; for these infrequent cases, please [start a discussion](https://github.com/leeoniya/dropcss/issues).
8+
DropCSS is an [exceptionally fast](#performance), thorough and tiny ([~10 KB min](https://github.com/leeoniya/dropcss/tree/master/dist/dropcss.min.js)) unused-CSS cleaner; it takes your HTML and CSS as input and returns only the used CSS as output. Its custom HTML and CSS parsers are highly optimized for the 99% use case and thus avoid the overhead of handling malformed markup or stylesheets, so you must provide well-formed input. There is minimal handling for complex escaping rules, so there will always exist cases of valid input that cannot be processed by DropCSS; for these infrequent cases, please [start a discussion](https://github.com/leeoniya/dropcss/issues).
99

1010
As a bonus, DropCSS will also remove unused `@keyframes` and `@font-face` blocks - an out-of-scope, purely intra-CSS optimization. Speaking of which, it's a good idea to run your CSS through a structural optimizer like [clean-css](https://github.com/jakubpawlowicz/clean-css), [csso](https://github.com/css/csso), [cssnano](https://github.com/cssnano/cssnano) or [crass](https://github.com/mattbasta/crass) to re-group selectors, merge redundant rules, etc. It probably makes sense to do this after DropCSS, which can leave redundant blocks, e.g. `.foo, .bar { color: red; } .bar { width: 50%; }` -> `.bar { color: red; } .bar { width: 50%; }` if `.foo` is absent from your markup.
1111

@@ -74,6 +74,27 @@ The `shouldDrop` hook is called for every CSS selector that could not be matched
7474
### Features
7575

7676
- Retention of all transient pseudo-class and pseudo-element selectors which cannot be deterministically checked from the parsed HTML.
77+
- Deep resolution of composed [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/--*), e.g:
78+
```css
79+
:root {
80+
--font-style: italic;
81+
--font-weight: bold;
82+
--line-height: var(--height)em;
83+
--font-family: 'Open Sans';
84+
--font: var(--font-style) var(--font-weight) 1em/var(--line-height) var(--font-family);
85+
--height: 1.6;
86+
}
87+
88+
@font-face {
89+
font-family: var(--font-family);
90+
src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
91+
url("/fonts/OpenSans-Regular-webfont.woff") format("woff");
92+
}
93+
94+
body {
95+
font: var(--font);
96+
}
97+
```
7798
- Supported selectors
7899
- `*` - universal
79100
- `<tag>` - tag

0 commit comments

Comments
 (0)