Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit 8964807

Browse files
committed
fix htmlMinifier error if user sets NODE_ENV after requiring vueify
1 parent 9e3f1ed commit 8964807

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

lib/compiler.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,14 @@ var assign = require('object-assign')
1313
var deindent = require('de-indent')
1414
var Emitter = require('events').EventEmitter
1515

16-
// production minifiers
17-
if (process.env.NODE_ENV === 'production') {
18-
var htmlMinifier = require('html-minifier')
19-
// required for Vue 1.0 shorthand syntax
20-
var htmlMinifyOptions = {
21-
collapseWhitespace: true,
22-
removeComments: true,
23-
collapseBooleanAttributes: true,
24-
removeAttributeQuotes: true,
25-
useShortDoctype: true,
26-
removeEmptyAttributes: true,
27-
removeOptionalTags: true
28-
}
16+
var htmlMinifyOptions = {
17+
collapseWhitespace: true,
18+
removeComments: true,
19+
collapseBooleanAttributes: true,
20+
removeAttributeQuotes: true,
21+
useShortDoctype: true,
22+
removeEmptyAttributes: true,
23+
removeOptionalTags: true
2924
}
3025

3126
// expose compiler
@@ -233,7 +228,7 @@ function processTemplate (node, filePath, id, hasScopedStyle, fullSource) {
233228
})
234229
.then(function (res) {
235230
if (process.env.NODE_ENV === 'production') {
236-
res.source = htmlMinifier.minify(res.source, htmlMinifyOptions)
231+
res.source = require('html-minifier').minify(res.source, htmlMinifyOptions)
237232
}
238233
return res
239234
})

0 commit comments

Comments
 (0)