Skip to content

Commit 7837c0c

Browse files
committed
use new defaultExtractor option
1 parent 38d860a commit 7837c0c

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,9 @@ module.exports = {
4242
### Configure Purgecss
4343
By default Purgecss will look for css selectors in your `.html` files inside the `./public` directory and `.vue` files inside the `./src` directory.
4444
```javascript
45-
class TailwindExtractor {
46-
static extract(content) {
47-
return content.match(/[A-Za-z0-9-_:\/]+/g) || [];
48-
}
49-
}
50-
5145
let config = {
5246
content: ['./public/**/*.html', './src/**/*.vue'],
53-
extractors: [
54-
{
55-
extractor: TailwindExtractor,
56-
extensions: ['html', 'vue'],
57-
},
58-
],
47+
defaultExtractor: content => content.match(/[A-z0-9-_:/]+/g),
5948
};
6049
```
6150
You can extend/override the default config in your PostCSS configuration.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"purgecss"
1919
],
2020
"dependencies": {
21-
"@fullhuman/postcss-purgecss": "^1.1.0",
22-
"tailwindcss": "^1.0.0-beta.3"
21+
"@fullhuman/postcss-purgecss": "^1.2.0",
22+
"tailwindcss": "^1.0.0-beta.5"
2323
}
2424
}

purgecss/index.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
const postcss = require('postcss');
22

3-
class TailwindExtractor {
4-
static extract(content) {
5-
return content.match(/[A-Za-z0-9-_:\/]+/g) || [];
6-
}
7-
}
8-
93
let config = {
104
content: ['./public/**/*.html', './src/**/*.vue'],
11-
extractors: [
12-
{
13-
extractor: TailwindExtractor,
14-
extensions: ['html', 'vue'],
15-
},
16-
],
5+
defaultExtractor: content => content.match(/[A-z0-9-_:/]+/g),
176
};
187

198
module.exports = postcss.plugin('tailwind-purgecss', function(opts) {

0 commit comments

Comments
 (0)