gulp-purgecss 4.0.3 → 4.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -7
- package/lib/gulp-purgecss.d.ts +41 -36
- package/lib/gulp-purgecss.esm.d.ts +41 -36
- package/lib/gulp-purgecss.esm.js +1 -1
- package/lib/gulp-purgecss.js +1 -1
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
# gulp-purgecss
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/FullHuman/gulp-purgecss)
|
|
4
|
-
[]()
|
|
5
|
-
[]()
|
|
6
|
-
[]()
|
|
7
|
-
[](https://www.codacy.com/app/FullHuman/gulp-purgecss?utm_source=github.com&utm_medium=referral&utm_content=FullHuman/gulp-purgecss&utm_campaign=Badge_Grade)
|
|
8
|
-
[](https://github.com/prettier/prettier)
|
|
9
3
|
[](https://www.npmjs.com/package/gulp-purgecss)
|
|
10
|
-
[]()
|
|
4
|
+
[]()
|
|
11
5
|
|
|
12
6
|
|
|
13
7
|
> [gulp](http://gulpjs.com/) plugin to removed unused CSS, using [purgecss](https://github.com/FullHuman/purgecss)
|
package/lib/gulp-purgecss.d.ts
CHANGED
|
@@ -1,56 +1,61 @@
|
|
|
1
1
|
import internal from "stream";
|
|
2
2
|
interface RawContent<T = string> {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
extension: string;
|
|
4
|
+
raw: T;
|
|
5
5
|
}
|
|
6
6
|
interface RawCSS {
|
|
7
|
-
|
|
7
|
+
raw: string;
|
|
8
|
+
name?: string;
|
|
8
9
|
}
|
|
9
10
|
interface ExtractorResultDetailed {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
attributes: {
|
|
12
|
+
names: string[];
|
|
13
|
+
values: string[];
|
|
14
|
+
};
|
|
15
|
+
classes: string[];
|
|
16
|
+
ids: string[];
|
|
17
|
+
tags: string[];
|
|
18
|
+
undetermined: string[];
|
|
18
19
|
}
|
|
19
20
|
type ExtractorResult = ExtractorResultDetailed | string[];
|
|
20
21
|
type ExtractorFunction<T = string> = (content: T) => ExtractorResult;
|
|
21
22
|
interface Extractors {
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
extensions: string[];
|
|
24
|
+
extractor: ExtractorFunction;
|
|
24
25
|
}
|
|
25
26
|
type StringRegExpArray = Array<RegExp | string>;
|
|
26
27
|
type ComplexSafelist = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
standard?: StringRegExpArray;
|
|
29
|
+
deep?: RegExp[];
|
|
30
|
+
greedy?: RegExp[];
|
|
31
|
+
variables?: StringRegExpArray;
|
|
32
|
+
keyframes?: StringRegExpArray;
|
|
32
33
|
};
|
|
33
34
|
type UserDefinedSafelist = StringRegExpArray | ComplexSafelist;
|
|
34
35
|
interface UserDefinedOptions {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
content: Array<string | RawContent>;
|
|
37
|
+
css: Array<string | RawCSS>;
|
|
38
|
+
defaultExtractor?: ExtractorFunction;
|
|
39
|
+
extractors?: Array<Extractors>;
|
|
40
|
+
fontFace?: boolean;
|
|
41
|
+
keyframes?: boolean;
|
|
42
|
+
output?: string;
|
|
43
|
+
rejected?: boolean;
|
|
44
|
+
rejectedCss?: boolean;
|
|
45
|
+
stdin?: boolean;
|
|
46
|
+
stdout?: boolean;
|
|
47
|
+
variables?: boolean;
|
|
48
|
+
safelist?: UserDefinedSafelist;
|
|
49
|
+
blocklist?: StringRegExpArray;
|
|
50
|
+
skippedContentGlobs?: Array<string>;
|
|
51
|
+
dynamicAttributes?: string[];
|
|
50
52
|
}
|
|
51
53
|
type PurgeCSSUserDefinedOptions = UserDefinedOptions;
|
|
52
|
-
interface UserDefinedOptions$0
|
|
53
|
-
|
|
54
|
+
interface UserDefinedOptions$0
|
|
55
|
+
extends Omit<PurgeCSSUserDefinedOptions, "css" | "content"> {
|
|
56
|
+
content: string[];
|
|
54
57
|
}
|
|
55
|
-
declare function gulpPurgeCSS(
|
|
58
|
+
declare function gulpPurgeCSS(
|
|
59
|
+
options: UserDefinedOptions$0
|
|
60
|
+
): internal.Transform;
|
|
56
61
|
export { gulpPurgeCSS as default };
|
|
@@ -1,56 +1,61 @@
|
|
|
1
1
|
import internal from "stream";
|
|
2
2
|
interface RawContent<T = string> {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
extension: string;
|
|
4
|
+
raw: T;
|
|
5
5
|
}
|
|
6
6
|
interface RawCSS {
|
|
7
|
-
|
|
7
|
+
raw: string;
|
|
8
|
+
name?: string;
|
|
8
9
|
}
|
|
9
10
|
interface ExtractorResultDetailed {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
attributes: {
|
|
12
|
+
names: string[];
|
|
13
|
+
values: string[];
|
|
14
|
+
};
|
|
15
|
+
classes: string[];
|
|
16
|
+
ids: string[];
|
|
17
|
+
tags: string[];
|
|
18
|
+
undetermined: string[];
|
|
18
19
|
}
|
|
19
20
|
type ExtractorResult = ExtractorResultDetailed | string[];
|
|
20
21
|
type ExtractorFunction<T = string> = (content: T) => ExtractorResult;
|
|
21
22
|
interface Extractors {
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
extensions: string[];
|
|
24
|
+
extractor: ExtractorFunction;
|
|
24
25
|
}
|
|
25
26
|
type StringRegExpArray = Array<RegExp | string>;
|
|
26
27
|
type ComplexSafelist = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
standard?: StringRegExpArray;
|
|
29
|
+
deep?: RegExp[];
|
|
30
|
+
greedy?: RegExp[];
|
|
31
|
+
variables?: StringRegExpArray;
|
|
32
|
+
keyframes?: StringRegExpArray;
|
|
32
33
|
};
|
|
33
34
|
type UserDefinedSafelist = StringRegExpArray | ComplexSafelist;
|
|
34
35
|
interface UserDefinedOptions {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
content: Array<string | RawContent>;
|
|
37
|
+
css: Array<string | RawCSS>;
|
|
38
|
+
defaultExtractor?: ExtractorFunction;
|
|
39
|
+
extractors?: Array<Extractors>;
|
|
40
|
+
fontFace?: boolean;
|
|
41
|
+
keyframes?: boolean;
|
|
42
|
+
output?: string;
|
|
43
|
+
rejected?: boolean;
|
|
44
|
+
rejectedCss?: boolean;
|
|
45
|
+
stdin?: boolean;
|
|
46
|
+
stdout?: boolean;
|
|
47
|
+
variables?: boolean;
|
|
48
|
+
safelist?: UserDefinedSafelist;
|
|
49
|
+
blocklist?: StringRegExpArray;
|
|
50
|
+
skippedContentGlobs?: Array<string>;
|
|
51
|
+
dynamicAttributes?: string[];
|
|
50
52
|
}
|
|
51
53
|
type PurgeCSSUserDefinedOptions = UserDefinedOptions;
|
|
52
|
-
interface UserDefinedOptions$0
|
|
53
|
-
|
|
54
|
+
interface UserDefinedOptions$0
|
|
55
|
+
extends Omit<PurgeCSSUserDefinedOptions, "css" | "content"> {
|
|
56
|
+
content: string[];
|
|
54
57
|
}
|
|
55
|
-
declare function gulpPurgeCSS(
|
|
58
|
+
declare function gulpPurgeCSS(
|
|
59
|
+
options: UserDefinedOptions$0
|
|
60
|
+
): internal.Transform;
|
|
56
61
|
export { gulpPurgeCSS as default };
|
package/lib/gulp-purgecss.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"
|
|
1
|
+
import e from"glob";import t from"plugin-error";import r from"purgecss";import n from"through2";function o(o){return n.obj((async function(s,c,i){if(s.isNull())return i(null,s);if(s.isBuffer())try{const t={...o,content:(u=o.content,u.reduce(((t,r)=>[...t,...e.sync(r)]),[])),css:[{raw:s.contents.toString()}],stdin:!0},n=(await(new r).purge(t))[0],c=t.rejected&&n.rejected?n.rejected.join(" {}\n")+" {}":n.css;s.contents=Buffer.from(c,"utf-8"),i(null,s)}catch(e){e instanceof Error&&this.emit("error",new t("gulp-purgecss",e.message))}var u;if(s.isStream()){let e="";s.contents.on("data",(t=>{e+=t.toString()})).on("end",(async()=>{try{const t={...o,css:[{raw:e}]},c=(await(new r).purge(t))[0],u=t.rejected&&c.rejected?c.rejected.join(" {}\n")+" {}":c.css,f=n();f.write(Buffer.from(u,"utf-8")),s.contents=s.contents.pipe(f),i(null,s)}catch(e){e instanceof Error&&this.emit("error",new t("gulp-purgecss",e.message))}}))}}))}export{o as default};
|
package/lib/gulp-purgecss.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("
|
|
1
|
+
"use strict";var e=require("glob"),t=require("plugin-error"),r=require("purgecss"),n=require("through2");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=u(e),c=u(t),o=u(r),i=u(n);module.exports=function(e){return i.default.obj((async function(t,r,n){if(t.isNull())return n(null,t);if(t.isBuffer())try{const r={...e,content:(u=e.content,u.reduce(((e,t)=>[...e,...s.default.sync(t)]),[])),css:[{raw:t.contents.toString()}],stdin:!0},c=(await(new o.default).purge(r))[0],i=r.rejected&&c.rejected?c.rejected.join(" {}\n")+" {}":c.css;t.contents=Buffer.from(i,"utf-8"),n(null,t)}catch(e){e instanceof Error&&this.emit("error",new c.default("gulp-purgecss",e.message))}var u;if(t.isStream()){let r="";t.contents.on("data",(e=>{r+=e.toString()})).on("end",(async()=>{try{const u={...e,css:[{raw:r}]},s=(await(new o.default).purge(u))[0],c=u.rejected&&s.rejected?s.rejected.join(" {}\n")+" {}":s.css,a=i.default();a.write(Buffer.from(c,"utf-8")),t.contents=t.contents.pipe(a),n(null,t)}catch(e){e instanceof Error&&this.emit("error",new c.default("gulp-purgecss",e.message))}}))}}))};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gulp-purgecss",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "Gulp plugin for purgecss",
|
|
5
5
|
"author": "Ffloriel",
|
|
6
6
|
"homepage": "https://purgecss.com",
|
|
@@ -37,16 +37,22 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"glob": "^7.1.6",
|
|
39
39
|
"plugin-error": "^1.0.1",
|
|
40
|
-
"purgecss": "^4.
|
|
40
|
+
"purgecss": "^4.1.3",
|
|
41
41
|
"through2": "^4.0.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
+
"@types/event-stream": "^4.0.0",
|
|
44
45
|
"@types/through2": "^2.0.34",
|
|
45
46
|
"@types/vinyl": "^2.0.4",
|
|
47
|
+
"event-stream": "^4.0.1",
|
|
46
48
|
"vinyl": "^2.2.0"
|
|
47
49
|
},
|
|
48
50
|
"bugs": {
|
|
49
51
|
"url": "https://github.com/FullHuman/purgecss/issues"
|
|
50
52
|
},
|
|
51
|
-
"
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public",
|
|
55
|
+
"registry": "https://registry.npmjs.org/"
|
|
56
|
+
},
|
|
57
|
+
"gitHead": "37e5053a446880d12fd2f55abfc362c3dac9c49c"
|
|
52
58
|
}
|