grunt-combohtml
Advanced tools
Comparing version 0.1.15 to 0.1.16
{ | ||
"name": "grunt-combohtml", | ||
"description": "combine build html with ssi.", | ||
"version": "0.1.15", | ||
"version": "0.1.16", | ||
"homepage": "", | ||
@@ -31,2 +31,3 @@ "author": { | ||
"dependencies": { | ||
"joinbuffers": "~0.1.1", | ||
"iconv-lite": "", | ||
@@ -33,0 +34,0 @@ "civet": "" |
@@ -15,2 +15,3 @@ /* | ||
url = require('url'), | ||
chunkParser = require('./chunk').parse, | ||
path = require('path'); | ||
@@ -33,2 +34,4 @@ | ||
var done = this.async(); | ||
var that = this; | ||
@@ -95,14 +98,17 @@ var pwd = process.cwd(); | ||
'brace_style': 'expand', | ||
'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u'] | ||
'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u','script'] | ||
}); | ||
} | ||
if(!(chunk instanceof Buffer)){ | ||
chunk = new Buffer(chunk); | ||
} | ||
if(options.encoding == 'gbk'){ | ||
chunk = iconv.encode(iconv.decode(chunk, 'utf8'),'gbk'); | ||
} | ||
fs.writeFileSync(v.dest,chunk); | ||
chunkParser(chunk,function(chunk){ | ||
chunk = teardownChunk(chunk,options.encoding); | ||
if(!(chunk instanceof Buffer)){ | ||
chunk = new Buffer(chunk); | ||
} | ||
if(options.encoding == 'gbk'){ | ||
chunk = iconv.encode(iconv.decode(chunk, 'utf8'),'gbk'); | ||
} | ||
fs.writeFileSync(v.dest,chunk); | ||
done(); | ||
}); | ||
@@ -115,2 +121,13 @@ }); | ||
// 传入的chunk一定是utf8的 | ||
function teardownChunk(chunk,encoding){ | ||
if(!(chunk instanceof Buffer)){ | ||
chunk = new Buffer(chunk); | ||
} | ||
if(encoding == 'gbk'){ | ||
chunk = iconv.encode(iconv.decode(chunk, 'utf8'),'gbk'); | ||
} | ||
return chunk; | ||
} | ||
function outputVmFile(content,fp){ | ||
@@ -117,0 +134,0 @@ var ctxt = civet.juicer2vm(content); |
@@ -9,3 +9,4 @@ // 'use strict'; | ||
var reg = '<!--#([a-z]+)(\\s([a-z]+)=[\'"](.+?)[\'"])* -->'; | ||
//var reg = '<!--#([a-z]+)(\\s([a-z]+)=[\'"](.+?)[\'"])* -->'; | ||
var reg = '<!--#(include)(\\s([a-z]+)=[\'"](.+?)[\'"])* -->'; | ||
var p = './xx.html'; | ||
@@ -64,2 +65,3 @@ var CTS = {}; | ||
function getContent(p){ | ||
var http_url_reg = /^.+\/http:\/([^\/].+)$/; | ||
if(CTS[p]){ | ||
@@ -70,2 +72,5 @@ return CTS[p]; | ||
return bf.toString('utf-8'); | ||
} else if(http_url_reg.test(p)){ | ||
var f_url = p.match(http_url_reg)[1]; | ||
return '<!--#chunk url="'+f_url+'" -->'; | ||
} else { | ||
@@ -72,0 +77,0 @@ return "<!-- " + p + " is not found! -->"; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100844
19
2530
4
7
3
+ Addedjoinbuffers@~0.1.1
+ Addedjoinbuffers@0.1.1(transitive)