mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
add html minifier for generate
This commit is contained in:
parent
7f3a39fea1
commit
4ebe6f7ac8
@ -8,6 +8,7 @@ const pathToRegexp = require('path-to-regexp')
|
||||
const _ = require('lodash')
|
||||
const { resolve, join, dirname, sep } = require('path')
|
||||
const { promisifyRouteParams } = require('./utils')
|
||||
const { minify } = require('html-minifier')
|
||||
const copy = pify(fs.copy)
|
||||
const remove = pify(fs.remove)
|
||||
const writeFile = pify(fs.writeFile)
|
||||
@ -87,7 +88,10 @@ module.exports = function () {
|
||||
while (routes.length) {
|
||||
yield routes.splice(0, 500).map((route) => {
|
||||
return co(function * () {
|
||||
const { html } = yield self.renderRoute(route)
|
||||
var { html } = yield self.renderRoute(route)
|
||||
html = minify(html, {
|
||||
collapseWhitespace: true
|
||||
})
|
||||
var path = join(route, sep, 'index.html') // /about -> /about/index.html
|
||||
debug('Generate file: ' + path)
|
||||
path = join(distPath, path)
|
||||
|
@ -63,6 +63,7 @@
|
||||
"fs-extra": "^1.0.0",
|
||||
"glob": "^7.1.1",
|
||||
"hash-sum": "^1.0.2",
|
||||
"html-minifier": "^3.2.3",
|
||||
"lodash": "^4.17.2",
|
||||
"lru-cache": "^4.0.2",
|
||||
"memory-fs": "^0.4.1",
|
||||
|
Loading…
Reference in New Issue
Block a user