-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(purgecss-webpack-plugin): load config file automatically #767
- Loading branch information
Showing
3 changed files
with
37 additions
and
23 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
packages/purgecss-webpack-plugin/__tests__/cases/simple/purgecss.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const path = require("path"); | ||
const glob = require("glob"); | ||
|
||
const customExtractor = (content) => { | ||
const res = content.match(/[A-z0-9-:/]+/g) || []; | ||
return res; | ||
}; | ||
|
||
const PATHS = { | ||
src: path.join(__dirname, "src"), | ||
}; | ||
|
||
module.exports = { | ||
paths: glob.sync(`${PATHS.src}/*`), | ||
safelist: ["safelisted"], | ||
extractors: [ | ||
{ | ||
extractor: customExtractor, | ||
extensions: ["html", "js"], | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters