|
11 | 11 |
|
12 | 12 | [📖 **Release Notes**](./CHANGELOG.md) |
13 | 13 |
|
| 14 | +## Release Note for purgecss 2 |
| 15 | +The extractor is now a function that takes the content as an argument. |
| 16 | +```js |
| 17 | +class Extractor { |
| 18 | + static extract(content) {} |
| 19 | +} |
| 20 | +``` |
| 21 | +changes to |
| 22 | +```js |
| 23 | +function extractor(content) {} |
| 24 | +``` |
| 25 | + |
| 26 | + |
14 | 27 | ## Features |
15 | 28 |
|
16 | 29 | * Remove unneeded CSS with ease |
@@ -57,10 +70,8 @@ Before diving into the individual attributes, here are the default settings of t |
57 | 70 | whitelist: ['body', 'html', 'nuxt-progress'], |
58 | 71 | extractors: [ |
59 | 72 | { |
60 | | - extractor: class { |
61 | | - static extract(content) { |
62 | | - return content.match(/[A-z0-9-:\\/]+/g) |
63 | | - } |
| 73 | + extractor(content) { |
| 74 | + return content.match(/[A-z0-9-:\\/]+/g) |
64 | 75 | }, |
65 | 76 | extensions: ['html', 'vue', 'js'] |
66 | 77 | } |
@@ -185,18 +196,14 @@ export default { |
185 | 196 | purgeCSS: { |
186 | 197 | extractors: () => [ |
187 | 198 | { |
188 | | - extractor: class { |
189 | | - static extract(content) { |
190 | | - return content.match(/[A-z0-9-:\\/]+/g) |
191 | | - } |
| 199 | + extractor: (content) { |
| 200 | + return content.match(/[A-z0-9-:\\/]+/g) |
192 | 201 | }, |
193 | 202 | extensions: ['html', 'vue', 'js'] |
194 | 203 | }, |
195 | 204 | { |
196 | | - extractor: class { |
197 | | - static extract(content) { |
198 | | - return content.match(/[A-z0-9-\\/]+/g) |
199 | | - } |
| 205 | + extractor(content) { |
| 206 | + return content.match(/[A-z0-9-\\/]+/g) |
200 | 207 | }, |
201 | 208 | extensions: ['vue'] // This will not work, because the above extractor is applied to 'vue' already. |
202 | 209 | } |
|
0 commit comments