gulp-purgecss
Advanced tools
Comparing version 2.1.0 to 2.1.2
@@ -1,23 +0,23 @@ | ||
import internal from 'stream'; | ||
import internal from "stream"; | ||
type ExtractorFunction = (content: string) => string[]; | ||
interface Extractors { | ||
extensions: string[]; | ||
extractor: ExtractorFunction; | ||
extensions: string[]; | ||
extractor: ExtractorFunction; | ||
} | ||
interface UserDefinedOptions { | ||
content: Array<string>; | ||
defaultExtractor?: ExtractorFunction; | ||
extractors?: Array<Extractors>; | ||
fontFace?: boolean; | ||
keyframes?: boolean; | ||
output?: string; | ||
rejected?: boolean; | ||
stdin?: boolean; | ||
stdout?: boolean; | ||
variables?: boolean; | ||
whitelist?: string[]; | ||
whitelistPatterns?: Array<RegExp>; | ||
whitelistPatternsChildren?: Array<RegExp>; | ||
content: Array<string>; | ||
defaultExtractor?: ExtractorFunction; | ||
extractors?: Array<Extractors>; | ||
fontFace?: boolean; | ||
keyframes?: boolean; | ||
output?: string; | ||
rejected?: boolean; | ||
stdin?: boolean; | ||
stdout?: boolean; | ||
variables?: boolean; | ||
whitelist?: string[]; | ||
whitelistPatterns?: Array<RegExp>; | ||
whitelistPatternsChildren?: Array<RegExp>; | ||
} | ||
declare function gulpPurgeCSS(options: UserDefinedOptions): internal.Transform; | ||
export { gulpPurgeCSS as default }; |
@@ -1,23 +0,23 @@ | ||
import internal from 'stream'; | ||
import internal from "stream"; | ||
type ExtractorFunction = (content: string) => string[]; | ||
interface Extractors { | ||
extensions: string[]; | ||
extractor: ExtractorFunction; | ||
extensions: string[]; | ||
extractor: ExtractorFunction; | ||
} | ||
interface UserDefinedOptions { | ||
content: Array<string>; | ||
defaultExtractor?: ExtractorFunction; | ||
extractors?: Array<Extractors>; | ||
fontFace?: boolean; | ||
keyframes?: boolean; | ||
output?: string; | ||
rejected?: boolean; | ||
stdin?: boolean; | ||
stdout?: boolean; | ||
variables?: boolean; | ||
whitelist?: string[]; | ||
whitelistPatterns?: Array<RegExp>; | ||
whitelistPatternsChildren?: Array<RegExp>; | ||
content: Array<string>; | ||
defaultExtractor?: ExtractorFunction; | ||
extractors?: Array<Extractors>; | ||
fontFace?: boolean; | ||
keyframes?: boolean; | ||
output?: string; | ||
rejected?: boolean; | ||
stdin?: boolean; | ||
stdout?: boolean; | ||
variables?: boolean; | ||
whitelist?: string[]; | ||
whitelistPatterns?: Array<RegExp>; | ||
whitelistPatternsChildren?: Array<RegExp>; | ||
} | ||
declare function gulpPurgeCSS(options: UserDefinedOptions): internal.Transform; | ||
export { gulpPurgeCSS as default }; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var through=_interopDefault(require("through2")),PluginError=_interopDefault(require("plugin-error")),glob=_interopDefault(require("glob")),PurgeCSS=_interopDefault(require("purgecss"));const PLUGIN_NAME="gulp-purgecss";function getFiles(e){return e.reduce((e,r)=>[...e,...glob.sync(r)],[])}function gulpPurgeCSS(e){return through.obj((async function(r,t,n){if(r.isNull())return n(null,r);if(r.isBuffer())try{const t={...e,content:getFiles(e.content),css:[{raw:r.contents.toString()}],stdin:!0},u=(await(new PurgeCSS).purge(t))[0],o=t.rejected&&u.rejected?u.rejected.join(" {}\n")+" {}":u.css;r.contents=Buffer.from(o,"utf-8"),n(null,r)}catch(e){this.emit("error",new PluginError(PLUGIN_NAME,e.message))}if(r.isStream()){const t=r;let u="";t.on("readable",e=>{u+=e.read().toString()}).on("end",async()=>{try{const o={...e,css:[u]},i=(await(new PurgeCSS).purge(o))[0],s=o.rejected&&i.rejected?i.rejected.join(" {}\n")+" {}":i.css;t.contents=Buffer.from(s,"utf-8"),n(null,r)}catch(e){this.emit("error",new PluginError(PLUGIN_NAME,e.message))}})}}))}module.exports=gulpPurgeCSS; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var r=e(require("through2")),t=e(require("plugin-error")),n=e(require("glob")),s=e(require("purgecss"));module.exports=function(e){return r.obj((async function(r,c,u){if(r.isNull())return u(null,r);if(r.isBuffer())try{const t={...e,content:(o=e.content,o.reduce((e,r)=>[...e,...n.sync(r)],[])),css:[{raw:r.contents.toString()}],stdin:!0},c=(await(new s).purge(t))[0],i=t.rejected&&c.rejected?c.rejected.join(" {}\n")+" {}":c.css;r.contents=Buffer.from(i,"utf-8"),u(null,r)}catch(e){this.emit("error",new t("gulp-purgecss",e.message))}var o;if(r.isStream()){const n=r;let c="";n.on("readable",e=>{c+=e.read().toString()}).on("end",async()=>{try{const t={...e,css:[c]},o=(await(new s).purge(t))[0],i=t.rejected&&o.rejected?o.rejected.join(" {}\n")+" {}":o.css;n.contents=Buffer.from(i,"utf-8"),u(null,r)}catch(e){this.emit("error",new t("gulp-purgecss",e.message))}})}}))}; |
{ | ||
"name": "gulp-purgecss", | ||
"version": "2.1.0", | ||
"version": "2.1.2", | ||
"description": "Gulp plugin for purgecss", | ||
@@ -40,3 +40,3 @@ "author": "Ffloriel", | ||
"plugin-error": "^1.0.1", | ||
"purgecss": "^2.1.0", | ||
"purgecss": "^2.1.2", | ||
"through2": "^3.0.1" | ||
@@ -52,3 +52,3 @@ }, | ||
}, | ||
"gitHead": "0ce7486ad5fa949e33b7162ab4aef02ff237c297" | ||
"gitHead": "98c2fa1e0efb894382395ea25a7aaa8562ab5ffe" | ||
} |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
8022
54
Updatedpurgecss@^2.1.2