Comparing version 1.0.4 to 1.0.5
@@ -6,6 +6,7 @@ 'use strict'; | ||
var puppeteer = _interopDefault(require('puppeteer')); | ||
var minifier = _interopDefault(require('html-minifier')); | ||
function getHTML(browser, { url, wait = 50, manually, onFetch, onFetched }) { | ||
function getHTML(browser, { url, wait = 50, manually, onFetch, onFetched, minify }) { | ||
return new Promise(function ($return, $error) { | ||
var page, html; | ||
var page, html, minifyOptions; | ||
@@ -45,3 +46,15 @@ onFetch && onFetch(url); | ||
onFetched && onFetched(url); | ||
return $return(html); | ||
minifyOptions = typeof minify === 'object' ? minify : { | ||
minifyCSS: true, | ||
minifyJS: true, | ||
collapseWhitespace: true, | ||
decodeEntities: true, | ||
removeComments: true, | ||
removeAttributeQuotes: true, | ||
removeScriptTypeAttributes: true, | ||
removeRedundantAttributes: true, | ||
removeStyleLinkTypeAttributes: true | ||
}; | ||
return $return(minify ? minifier.minify(html, minifyOptions) : html); | ||
} catch ($boundEx) { | ||
@@ -48,0 +61,0 @@ return $error($boundEx); |
{ | ||
"name": "taki", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Take a snapshot of any website.", | ||
@@ -30,2 +30,3 @@ "repository": { | ||
"dependencies": { | ||
"html-minifier": "^3.5.8", | ||
"puppeteer": "^0.13.0" | ||
@@ -32,0 +33,0 @@ }, |
@@ -86,2 +86,13 @@ # taki | ||
### Minify | ||
Minify HTML. | ||
```js | ||
taki({ | ||
url, | ||
minify: true | ||
}) | ||
``` | ||
## Contributing | ||
@@ -88,0 +99,0 @@ |
9445
119
112
2
+ Addedhtml-minifier@^3.5.8
+ Addedcamel-case@3.0.0(transitive)
+ Addedclean-css@4.2.4(transitive)
+ Addedcommander@2.17.12.19.0(transitive)
+ Addedhe@1.2.0(transitive)
+ Addedhtml-minifier@3.5.21(transitive)
+ Addedlower-case@1.1.4(transitive)
+ Addedno-case@2.3.2(transitive)
+ Addedparam-case@2.1.1(transitive)
+ Addedrelateurl@0.2.7(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addeduglify-js@3.4.10(transitive)
+ Addedupper-case@1.1.3(transitive)