flex-combo
Advanced tools
Comparing version 0.4.7 to 0.4.8
@@ -11,5 +11,5 @@ var http = require('http') | ||
, util = require('util') | ||
, mime = require('mime'); | ||
, mime = require('mime') | ||
, juicer = require('juicer'); | ||
var debug = require('debug')('flex-combo:debug'); | ||
@@ -151,3 +151,2 @@ var debugInfo = require('debug')('flex-combo:info'); | ||
} | ||
if(fs.existsSync(absPath)){ | ||
@@ -169,2 +168,23 @@ var buff = fs.readFileSync(absPath); | ||
} | ||
//前后端模板一致化,如果是*.html.js格式的请求,并且js文件不存在,则编译*.html为juicer的function格式返回 | ||
var extName = path.extname(absPath); | ||
var htmlName = absPath.slice(0, absPath.length - extName.length); | ||
if(path.extname(htmlName).toLowerCase() === '.html' ){ | ||
var buff = fs.readFileSync(htmlName); | ||
var charset = isUtf8(buff) ? 'utf8' : 'gbk'; | ||
var tpl = iconv.decode(buff, charset); | ||
var compiled = juicer(tpl)._render; | ||
//允许为某个url特别指定编码 | ||
var outputCharset = param.charset; | ||
if(param.urlBasedCharset && param.urlBasedCharset[longestMatchPos]){ | ||
outputCharset = param.urlBasedCharset[longestMatchPos]; | ||
} | ||
var tempalteFunction = 'window["'+revPath+'"] = ' + compiled.toString(); | ||
cosoleResp('Local Juicer Compile', htmlName); | ||
return iconv.encode(tempalteFunction, outputCharset); | ||
} | ||
} | ||
@@ -171,0 +191,0 @@ return null; |
{ | ||
"name": "flex-combo", | ||
"version": "0.4.7", | ||
"version": "0.4.8", | ||
"description": "The Flex-combo is combo tool designed for web front-end developer. It support various kinds of combo format by modify configuration(eg. yahoo combo).", | ||
@@ -18,3 +18,4 @@ "main": "flex-combo.js", | ||
"mime":"1.2.7", | ||
"debug":"0.7.0" | ||
"debug":"0.7.0", | ||
"juicer":"0.6.5" | ||
}, | ||
@@ -21,0 +22,0 @@ "devDependencies": {}, |
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
82163
1587
9
+ Addedjuicer@0.6.5