Skip to content

Commit 4c93433

Browse files
author
zhuqiacheng
committed
edit interpolate replace
1 parent c6c68fa commit 4c93433

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ module.exports = function(content) {
6666
content.reverse();
6767
content = content.join("");
6868

69-
if(config.interpolate){
69+
if (config.interpolate === 'require'){
70+
7071
var reg = /\$\{require\([^)]*\)\}/g;
7172
var result;
7273
var reqList = [];
@@ -118,7 +119,11 @@ module.exports = function(content) {
118119
content = htmlMinifier.minify(content, minimizeOptions);
119120
}
120121

121-
content = JSON.stringify(content);
122+
if(config.interpolate && config.interpolate !== 'require') {
123+
content = compile('`' + content + '`').code;
124+
} else {
125+
content = JSON.stringify(content);
126+
}
122127

123128
return "module.exports = " + content.replace(/xxxHTMLLINKxxx[0-9\.]+xxx/g, function(match) {
124129
if(!data[match]) return match;

0 commit comments

Comments
 (0)