grunt-combohtml
Advanced tools
Comparing version 0.1.12 to 0.1.13
{ | ||
"name": "grunt-combohtml", | ||
"description": "combine build html with ssi.", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"homepage": "", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -36,4 +36,6 @@ # grunt-combohtml | ||
}, | ||
convert2vm:true,// 是否将juicer语法块转换为vm格式 | ||
convert2php:true,// 是否将juicer语法块转换为php格式 | ||
relative:'http://g.tbcdn.cn/group/trip/1.2.3/',// 本地资源文件名替换的前缀 | ||
convert2vm:false,// 是否将juicer语法块转换为vm格式 | ||
convert2php:false,// 是否将juicer语法块转换为php格式 | ||
convert2tms:false,// 是否将juicer语法块转换为php格式 | ||
comboJS:true, // 是否静态合并当前页面引用的本地js | ||
@@ -59,2 +61,4 @@ comboCSS:true // 是否静态合并当前页面引用的css | ||
> relative和comboJS与comboCSS的配置互斥 | ||
## 执行任务 | ||
@@ -61,0 +65,0 @@ |
@@ -22,2 +22,3 @@ /* | ||
var extract = require('./extract'); | ||
var relativeParse = require('./relative').parse; | ||
var concat = require('./concat').concat; | ||
@@ -48,22 +49,30 @@ | ||
var result = extract.parse(chunk,{ | ||
comboJS:typeof options.comboJS == 'undefined' || options.comboJS === true, | ||
comboCSS:typeof options.comboCSS == 'undefined' || options.comboCSS === true | ||
}); | ||
// TODO: 这里的逻辑需要重构了 | ||
if(typeof options.relative !== "undefined"){ | ||
// 相对路径编译成绝对路径 | ||
chunk = relativeParse(chunk,options.relative,filep).content; | ||
} else { | ||
// 相对路径执行静态合并 | ||
var result = extract.parse(chunk,{ | ||
comboJS:typeof options.comboJS == 'undefined' || options.comboJS === true, | ||
comboCSS:typeof options.comboCSS == 'undefined' || options.comboCSS === true | ||
}); | ||
chunk = result.content; | ||
chunk = result.content; | ||
if(typeof options.comboJS == 'undefined' || options.comboJS === true){ | ||
var js_content = concat(result.js,dest_js,v.orig.cwd,p,options.replacement); | ||
} | ||
if(typeof options.comboCSS == 'undefined' || options.comboCSS === true){ | ||
var css_content = concat(result.css,dest_css,v.orig.cwd,p,options.replacement); | ||
} | ||
if(typeof options.comboJS == 'undefined' || options.comboJS === true){ | ||
chunk = chunk.replace('@@script',path.basename(v.dest,path.extname(v.dest)) + '.js'); | ||
} | ||
if(typeof options.comboJS == 'undefined' || options.comboJS === true){ | ||
var js_content = concat(result.js,dest_js,v.orig.cwd,p,options.replacement); | ||
} | ||
if(typeof options.comboCSS == 'undefined' || options.comboCSS === true){ | ||
var css_content = concat(result.css,dest_css,v.orig.cwd,p,options.replacement); | ||
} | ||
if(typeof options.comboJS == 'undefined' || options.comboJS === true){ | ||
chunk = chunk.replace('@@script',path.basename(v.dest,path.extname(v.dest)) + '.js'); | ||
} | ||
if(typeof options.comboCSS == 'undefined' || options.comboCSS === true){ | ||
chunk = chunk.replace('@@style',path.basename(v.dest,path.extname(v.dest)) + '.css'); | ||
if(typeof options.comboCSS == 'undefined' || options.comboCSS === true){ | ||
chunk = chunk.replace('@@style',path.basename(v.dest,path.extname(v.dest)) + '.css'); | ||
} | ||
} | ||
@@ -70,0 +79,0 @@ |
93789
18
2439
74
6