Skip to content
This repository was archived by the owner on Feb 1, 2020. It is now read-only.

Commit 4ffaa71

Browse files
committed
run prettier
- add whitelistPatterns to whitelist functions test - run prettier
1 parent ce3870c commit 4ffaa71

File tree

13 files changed

+428
-395
lines changed

13 files changed

+428
-395
lines changed

__tests__/__snapshots__/webpack-integration.test.js.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ exports[`Webpack Integration Tests path-and-whitelist-functions 1`] = `
99
color: green;
1010
}
1111
12+
.whitelistedPattern {
13+
color: rebeccapurple;
14+
}
15+
1216
md\\\\:w-2\\\\/3 {
1317
color: red;
1418
}

__tests__/cases/path-and-whitelist-functions/expected/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
color: green;
77
}
88

9+
.whitelistedPattern {
10+
color: rebeccapurple;
11+
}
12+
913
md\:w-2\/3 {
1014
color: red;
1115
}

__tests__/cases/path-and-whitelist-functions/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
color: green;
1111
}
1212

13+
.whitelistedPattern {
14+
color: rebeccapurple;
15+
}
16+
1317
md\:w-2\/3 {
1418
color: red;
1519
}

__tests__/cases/path-and-whitelist-functions/webpack.config.js

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,39 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin')
44
const PurgecssPlugin = require('../../../src/').default
55

66
class CustomExtractor {
7-
static extract(content) {
8-
return content.match(/[A-z0-9-:/]+/g)
9-
}
7+
static extract(content) {
8+
return content.match(/[A-z0-9-:/]+/g)
9+
}
1010
}
1111

1212
const PATHS = {
13-
src: path.join(__dirname, 'src')
13+
src: path.join(__dirname, 'src')
1414
}
1515

1616
module.exports = {
17-
entry: './src/index.js',
18-
module: {
19-
rules: [
20-
{
21-
test: /\.css$/,
22-
use: ExtractTextPlugin.extract({
23-
use: 'css-loader?sourceMap'
17+
entry: './src/index.js',
18+
module: {
19+
rules: [
20+
{
21+
test: /\.css$/,
22+
use: ExtractTextPlugin.extract({
23+
use: 'css-loader?sourceMap'
24+
})
25+
}
26+
]
27+
},
28+
plugins: [
29+
new ExtractTextPlugin('style.css'),
30+
new PurgecssPlugin({
31+
paths: () => glob.sync(`${PATHS.src}/*`),
32+
whitelist: () => ['whitelisted'],
33+
whitelistPatterns: () => [/^whitelistedPat/],
34+
extractors: [
35+
{
36+
extractor: CustomExtractor,
37+
extensions: ['html', 'js']
38+
}
39+
]
2440
})
25-
}
2641
]
27-
},
28-
plugins: [
29-
new ExtractTextPlugin('style.css'),
30-
new PurgecssPlugin({
31-
paths: () => glob.sync(`${PATHS.src}/*`),
32-
whitelist: () => ['whitelisted'],
33-
extractors: [
34-
{
35-
extractor: CustomExtractor,
36-
extensions: ['html', 'js']
37-
}
38-
]
39-
})
40-
]
4142
}
Lines changed: 102 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,106 @@
1-
/******/ (function(modules) { // webpackBootstrap
2-
/******/ // The module cache
3-
/******/ var installedModules = {};
4-
/******/
5-
/******/ // The require function
6-
/******/ function __webpack_require__(moduleId) {
7-
/******/
8-
/******/ // Check if module is in cache
9-
/******/ if(installedModules[moduleId]) {
10-
/******/ return installedModules[moduleId].exports;
11-
/******/ }
12-
/******/ // Create a new module (and put it into the cache)
13-
/******/ var module = installedModules[moduleId] = {
14-
/******/ i: moduleId,
15-
/******/ l: false,
16-
/******/ exports: {}
17-
/******/ };
18-
/******/
19-
/******/ // Execute the module function
20-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21-
/******/
22-
/******/ // Flag the module as loaded
23-
/******/ module.l = true;
24-
/******/
25-
/******/ // Return the exports of the module
26-
/******/ return module.exports;
27-
/******/ }
28-
/******/
29-
/******/
30-
/******/ // expose the modules object (__webpack_modules__)
31-
/******/ __webpack_require__.m = modules;
32-
/******/
33-
/******/ // expose the module cache
34-
/******/ __webpack_require__.c = installedModules;
35-
/******/
36-
/******/ // define getter function for harmony exports
37-
/******/ __webpack_require__.d = function(exports, name, getter) {
38-
/******/ if(!__webpack_require__.o(exports, name)) {
39-
/******/ Object.defineProperty(exports, name, {
40-
/******/ configurable: false,
41-
/******/ enumerable: true,
42-
/******/ get: getter
43-
/******/ });
44-
/******/ }
45-
/******/ };
46-
/******/
47-
/******/ // getDefaultExport function for compatibility with non-harmony modules
48-
/******/ __webpack_require__.n = function(module) {
49-
/******/ var getter = module && module.__esModule ?
50-
/******/ function getDefault() { return module['default']; } :
51-
/******/ function getModuleExports() { return module; };
52-
/******/ __webpack_require__.d(getter, 'a', getter);
53-
/******/ return getter;
54-
/******/ };
55-
/******/
56-
/******/ // Object.prototype.hasOwnProperty.call
57-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58-
/******/
59-
/******/ // __webpack_public_path__
60-
/******/ __webpack_require__.p = "";
61-
/******/
62-
/******/ // Load entry module and return exports
63-
/******/ return __webpack_require__(__webpack_require__.s = 0);
64-
/******/ })
65-
/************************************************************************/
66-
/******/ ([
67-
/* 0 */
68-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
1+
/******/ ;(function(modules) {
2+
// webpackBootstrap
3+
/******/ // The module cache
4+
/******/ var installedModules = {} // The require function
5+
/******/
6+
/******/ /******/ function __webpack_require__(moduleId) {
7+
/******/
8+
/******/ // Check if module is in cache
9+
/******/ if (installedModules[moduleId]) {
10+
/******/ return installedModules[moduleId].exports
11+
/******/
12+
} // Create a new module (and put it into the cache)
13+
/******/ /******/ var module = (installedModules[moduleId] = {
14+
/******/ i: moduleId,
15+
/******/ l: false,
16+
/******/ exports: {}
17+
/******/
18+
}) // Execute the module function
19+
/******/
20+
/******/ /******/ modules[moduleId].call(
21+
module.exports,
22+
module,
23+
module.exports,
24+
__webpack_require__
25+
) // Flag the module as loaded
26+
/******/
27+
/******/ /******/ module.l = true // Return the exports of the module
28+
/******/
29+
/******/ /******/ return module.exports
30+
/******/
31+
} // expose the modules object (__webpack_modules__)
32+
/******/
33+
/******/
34+
/******/ /******/ __webpack_require__.m = modules // expose the module cache
35+
/******/
36+
/******/ /******/ __webpack_require__.c = installedModules // define getter function for harmony exports
37+
/******/
38+
/******/ /******/ __webpack_require__.d = function(exports, name, getter) {
39+
/******/ if (!__webpack_require__.o(exports, name)) {
40+
/******/ Object.defineProperty(exports, name, {
41+
/******/ configurable: false,
42+
/******/ enumerable: true,
43+
/******/ get: getter
44+
/******/
45+
})
46+
/******/
47+
}
48+
/******/
49+
} // getDefaultExport function for compatibility with non-harmony modules
50+
/******/
51+
/******/ /******/ __webpack_require__.n = function(module) {
52+
/******/ var getter =
53+
module && module.__esModule
54+
? /******/ function getDefault() {
55+
return module['default']
56+
}
57+
: /******/ function getModuleExports() {
58+
return module
59+
}
60+
/******/ __webpack_require__.d(getter, 'a', getter)
61+
/******/ return getter
62+
/******/
63+
} // Object.prototype.hasOwnProperty.call
64+
/******/
65+
/******/ /******/ __webpack_require__.o = function(object, property) {
66+
return Object.prototype.hasOwnProperty.call(object, property)
67+
} // __webpack_public_path__
68+
/******/
69+
/******/ /******/ __webpack_require__.p = '' // Load entry module and return exports
70+
/******/
71+
/******/ /******/ return __webpack_require__((__webpack_require__.s = 0))
72+
/******/
73+
})(
74+
/************************************************************************/
75+
/******/ [
76+
/* 0 */
77+
/***/ function(module, __webpack_exports__, __webpack_require__) {
78+
'use strict'
79+
Object.defineProperty(__webpack_exports__, '__esModule', { value: true })
80+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_that_we_want_to_purge_css__ = __webpack_require__(
81+
1
82+
)
83+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_that_we_want_to_purge_css___default = __webpack_require__.n(
84+
__WEBPACK_IMPORTED_MODULE_0__style_that_we_want_to_purge_css__
85+
)
6986

70-
"use strict";
71-
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
72-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_that_we_want_to_purge_css__ = __webpack_require__(1);
73-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_that_we_want_to_purge_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__style_that_we_want_to_purge_css__);
87+
function component() {
88+
var element = document.createElement('div')
7489

90+
element.classList.add('hello')
91+
element.classList.add('md:w-2/3')
92+
return element
93+
}
7594

76-
function component() {
77-
var element = document.createElement('div')
95+
document.body.appendChild(component())
7896

79-
element.classList.add('hello')
80-
element.classList.add('md:w-2/3')
81-
return element
82-
}
83-
84-
document.body.appendChild(component())
85-
86-
87-
/***/ }),
88-
/* 1 */
89-
/***/ (function(module, exports) {
90-
91-
// removed by extract-text-webpack-plugin
92-
93-
/***/ })
94-
/******/ ]);
97+
/***/
98+
},
99+
/* 1 */
100+
/***/ function(module, exports) {
101+
// removed by extract-text-webpack-plugin
102+
/***/
103+
}
104+
/******/
105+
]
106+
)

0 commit comments

Comments
 (0)