Comparing version
@@ -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
8.5%119
11.21%112
10.89%2
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added