ce4c83ff
wxy
εε§ζδΊ€
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# [postcss][postcss]-discard-unused [][ci] [][npm] [][deps]
> Discard unused counter styles, keyframes and fonts.
## Install
With [npm](https://npmjs.org/package/postcss-discard-unused) do:
```
npm install postcss-discard-unused --save
```
## Example
This module will discard unused at rules in your CSS file, if it cannot find
any selectors that make use of them. It works on `@counter-style`, `@keyframes`
and `@font-face`.
### Input
```css
@counter-style custom {
system: extends decimal;
suffix: "> "
}
@counter-style custom2 {
system: extends decimal;
suffix: "| "
}
a {
list-style: custom
}
```
### Output
```css
@counter-style custom {
system: extends decimal;
suffix: "> "
}
a {
list-style: custom
}
```
Note that this plugin is not responsible for normalising font families, as it
makes the assumption that you will write your font names consistently, such that
it considers these two declarations differently:
```css
h1 {
font-family: "Helvetica Neue"
}
h2 {
font-family: Helvetica Neue
}
```
However, you can mitigate this by including [postcss-minify-font-values][mfv]
*before* this plugin, which will take care of normalising quotes, and
deduplicating. For more examples, see the [tests](test.js).
## Usage
See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
examples for your environment.
## API
### discardUnused([options])
#### options
##### fontFace
Type: `boolean`
Default: `true`
Pass `false` to disable discarding unused font face rules.
##### counterStyle
Type: `boolean`
Default: `true`
Pass `false` to disable discarding unused counter style rules.
##### keyframes
Type: `boolean`
Default: `true`
Pass `false` to disable discarding unused keyframe rules.
##### namespace
Type: `boolean`
Default: `true`
Pass `false` to disable discarding unused namespace rules.
## Contributors
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
| [<img src="https://avatars.githubusercontent.com/u/1282980?v=3" width="100px;"/><br /><sub>Ben Briggs</sub>](http://beneb.info)<br />[π»](https://github.com/ben-eb/postcss-discard-unused/commits?author=ben-eb) [π](https://github.com/ben-eb/postcss-discard-unused/commits?author=ben-eb) π [β οΈ](https://github.com/ben-eb/postcss-discard-unused/commits?author=ben-eb) | [<img src="https://avatars.githubusercontent.com/u/5635476?v=3" width="100px;"/><br /><sub>Bogdan Chadkin</sub>](https://github.com/TrySound)<br />[π»](https://github.com/ben-eb/postcss-discard-unused/commits?author=TrySound) [π](https://github.com/ben-eb/postcss-discard-unused/commits?author=TrySound) π [β οΈ](https://github.com/ben-eb/postcss-discard-unused/commits?author=TrySound) | [<img src="https://avatars.githubusercontent.com/u/770675?v=3" width="100px;"/><br /><sub>PaweΕ Lesiecki</sub>](https://github.com/plesiecki)<br />[π»](https://github.com/ben-eb/postcss-discard-unused/commits?author=plesiecki) [β οΈ](https://github.com/ben-eb/postcss-discard-unused/commits?author=plesiecki) | [<img src="https://avatars.githubusercontent.com/u/197928?v=3" width="100px;"/><br /><sub>Thomas McDonald</sub>](https://github.com/thomas-mcdonald)<br />[π»](https://github.com/ben-eb/postcss-discard-unused/commits?author=thomas-mcdonald) [β οΈ](https://github.com/ben-eb/postcss-discard-unused/commits?author=thomas-mcdonald) |
| :---: | :---: | :---: | :---: |
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors] specification. Contributions of
any kind welcome!
## License
MIT Β© [Ben Briggs](http://beneb.info)
[all-contributors]: https://github.com/kentcdodds/all-contributors
[ci]: https://travis-ci.org/ben-eb/postcss-discard-unused
[deps]: https://gemnasium.com/ben-eb/postcss-discard-unused
[npm]: http://badge.fury.io/js/postcss-discard-unused
[postcss]: https://github.com/postcss/postcss
[mfv]: https://github.com/trysound/postcss-minify-font-values
|