This repository was archived by the owner on Feb 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 12 files changed +213
-38
lines changed Expand file tree Collapse file tree 12 files changed +213
-38
lines changed Original file line number Diff line number Diff line change 11{
2- "presets" : [
3- [
4- " env" ,
5- {
6- "modules" : false
7- }
8- ]
9- ],
10- "plugins" : [
11- " external-helpers" ,
12- " syntax-object-rest-spread" ,
13- " transform-object-rest-spread"
14- ]
15-
16- // {
17- // "presets": ["es2015-rollup"],
18- // "plugins": ["syntax-object-rest-spread", "transform-object-rest-spread"]
19- // }
2+ "env" : {
3+ "test" : {
4+ "presets" : [" env" ],
5+ "plugins" : [" syntax-object-rest-spread" , " transform-object-rest-spread" ]
6+ },
7+ "development" : {
8+ "presets" : [
9+ [
10+ " env" ,
11+ {
12+ "targets" : {
13+ "browsers" : [" last 2 versions" ]
14+ },
15+ "modules" : false
16+ }
17+ ]
18+ ],
19+ "plugins" : [
20+ " external-helpers" ,
21+ " syntax-object-rest-spread" ,
22+ " transform-object-rest-spread"
23+ ]
24+ }
25+ }
2026}
Original file line number Diff line number Diff line change 11{
2- "extends": "eslint:recommended",
3- "parserOptions": {
4- "ecmaVersion": 6,
5- "sourceType": "module"
6- },
7- "env": {
8- "browser": true,
9- "commonjs": true,
10- "node": true,
11- "es6": true
12- }
13- }
2+ "extends": "eslint:recommended",
3+ "parserOptions": {
4+ "ecmaVersion": 6,
5+ "sourceType": "module"
6+ },
7+ "env": {
8+ "browser": true,
9+ "commonjs": true,
10+ "node": true,
11+ "es6": true
12+ },
13+ "parser": "babel-eslint"
14+ }
Original file line number Diff line number Diff line change 1+ /__tests__ /js
2+
13# Logs
24logs
35* .log
Original file line number Diff line number Diff line change 1+ {
2+ "env": {
3+ "jest": true
4+ }
5+ }
Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` Webpack Integration Tests simple 1` ] = `
4+ ".hello {
5+ color : red ;
6+ }
7+
8+ .whitelisted {
9+ color : green ;
10+ }
11+
12+ md\\\\ :w-2\\\\ /3 {
13+ color : red ;
14+ }
15+ "
16+ ` ;
Original file line number Diff line number Diff line change 1+ .hello {
2+ color : red;
3+ }
4+
5+ .whitelisted {
6+ color : green;
7+ }
8+
9+ md \:w-2\/3 {
10+ color : red;
11+ }
Original file line number Diff line number Diff line change 1+ < html >
2+
3+ < head >
4+ < title > Purgecss webpack test</ title >
5+ </ head >
6+
7+ < body >
8+ < div class ="md:w-2/3 "> </ div >
9+ < div class ="hello "> </ div >
10+ < div > </ div >
11+ </ body >
12+
13+ </ html >
Original file line number Diff line number Diff line change 1+ import './../style.css'
Original file line number Diff line number Diff line change 1+ .hello {
2+ color : red;
3+ }
4+
5+ .unused {
6+ color : blue;
7+ }
8+
9+ .whitelisted {
10+ color : green;
11+ }
12+
13+ md \:w-2\/3 {
14+ color : red;
15+ }
Original file line number Diff line number Diff line change 1+ const path = require ( 'path' )
2+ const glob = require ( 'glob' )
3+ const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
4+ const PurgecssPlugin = require ( '../../../src/' ) . default
5+
6+ class CustomExtractor {
7+ static extract ( content ) {
8+ return content . match ( / [ A - z 0 - 9 - :/ ] + / g)
9+ }
10+ }
11+
12+ const PATHS = {
13+ src : path . join ( __dirname , 'src' )
14+ }
15+
16+ module . exports = {
17+ entry : './src/index.js' ,
18+ // output: {
19+ // filename: 'bundle.js',
20+ // path: path.join(__dirname, 'dist')
21+ // },
22+ module : {
23+ rules : [
24+ {
25+ test : / \. c s s $ / ,
26+ use : ExtractTextPlugin . extract ( {
27+ fallback : 'style-loader' ,
28+ use : 'css-loader?sourceMap'
29+ } )
30+ }
31+ ]
32+ } ,
33+ plugins : [
34+ new ExtractTextPlugin ( 'style.css' ) ,
35+ new PurgecssPlugin ( {
36+ paths : glob . sync ( `${ PATHS . src } /*` ) ,
37+ whitelist : [ 'whitelisted' ] ,
38+ extractors : [
39+ {
40+ extractor : CustomExtractor ,
41+ extensions : [ 'html' , 'js' ]
42+ }
43+ ]
44+ } )
45+ ]
46+ }
You can’t perform that action at this time.
0 commit comments