grunt-combohtml
Advanced tools
Comparing version 0.1.36 to 0.1.37
{ | ||
"name": "grunt-combohtml", | ||
"description": "combine build html with ssi.", | ||
"version": "0.1.36", | ||
"version": "0.1.37", | ||
"homepage": "https://github.com/jayli/grunt-combohtml", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -93,2 +93,4 @@ # grunt-combohtml | ||
如果html中引用js和css时带有`?nocombo=true`参数,则不合并 | ||
2. combo模式合并:若希望页面中引用的相对路径都编译为绝对路径并组成combo的模式`http://url/??a.js,b.js`,需要开始`relative`字段,这时`comboJS`和`comboCSS`字段不起作用 | ||
@@ -95,0 +97,0 @@ |
@@ -0,0 +0,0 @@ /*jslint onevar: false, plusplus: false */ |
@@ -0,0 +0,0 @@ // 'use strict'; |
@@ -18,2 +18,3 @@ // 'use strict'; | ||
// a.js?nocombo=true 的请求都过滤掉,不做合并 | ||
/* | ||
@@ -36,7 +37,18 @@ var x = read('xx.html'); | ||
content:insertScript(recall(content)), | ||
js:distinct(JS_Files), | ||
css:distinct(CSS_Files) | ||
js:cleanUpNoComboFiles(distinct(JS_Files)), | ||
css:cleanUpNoComboFiles(distinct(CSS_Files)) | ||
}; | ||
} | ||
// 将数组中带有nocombo=true的问题都清除掉 | ||
function cleanUpNoComboFiles(flist){ | ||
var a = []; | ||
flist.forEach(function(item){ | ||
if(!/nocombo=true/i.test(item)){ | ||
a.push(item); | ||
} | ||
}); | ||
return a; | ||
} | ||
function inArray (v, a){ | ||
@@ -89,5 +101,7 @@ var o = false; | ||
// http 请求都完全恢复 | ||
// nocombo=true的请求也完全恢复 | ||
content = content.replace(new RegExp('(<!--css:([^>]*?)-->)','gi'),function(){ | ||
var args = arguments; | ||
if(/http:/i.test(args[2]) || comboCSS === false){ | ||
if(/http:/i.test(args[2]) || comboCSS === false || /nocombo=true/i.test(args[2])){ | ||
if(/\.ico$/i.test(args[2])){ | ||
@@ -102,5 +116,7 @@ return '<link type="image/x-icon" rel="shortcut icon" href="'+args[2]+'" />'; | ||
// http 请求都完全恢复 | ||
// nocombo=true的请求也完全恢复 | ||
content = content.replace(new RegExp('(<!--js:([^>]*?)-->)','gi'),function(){ | ||
var args = arguments; | ||
if(/http:/i.test(args[2]) || comboJS === false){ | ||
if(/http:/i.test(args[2]) || comboJS === false || /nocombo=true/i.test(args[2])){ | ||
return '<script src="'+args[2]+'"></script>'; | ||
@@ -107,0 +123,0 @@ } else { |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ |
4016
185
157323