flex-combo
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -150,24 +150,7 @@ var http = require('http') | ||
} | ||
if(fs.existsSync(absPath)){ | ||
var buff = fs.readFileSync(absPath); | ||
if(isBinFile(absPath)){ | ||
cosoleResp('Local', absPath); | ||
return buff; | ||
} | ||
var charset = isUtf8(buff) ? 'utf8' : 'gbk'; | ||
//允许为某个url特别指定编码 | ||
var outputCharset = param.charset; | ||
if(param.urlBasedCharset && param.urlBasedCharset[longestMatchPos]){ | ||
outputCharset = param.urlBasedCharset[longestMatchPos]; | ||
} | ||
cosoleResp('Local', absPath); | ||
return adaptCharset(buff, outputCharset, charset); | ||
} | ||
//前后端模板一致化,如果是*.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' ){ | ||
if(path.extname(htmlName).toLowerCase() === '.html' && fs.existsSync(htmlName)){ | ||
var buff = fs.readFileSync(htmlName); | ||
@@ -186,4 +169,23 @@ var charset = isUtf8(buff) ? 'utf8' : 'gbk'; | ||
cosoleResp('Local Juicer Compile', htmlName); | ||
fs.writeFile(absPath, tempalteFunction); | ||
return iconv.encode(tempalteFunction, outputCharset); | ||
} | ||
if(fs.existsSync(absPath)){ | ||
var buff = fs.readFileSync(absPath); | ||
if(isBinFile(absPath)){ | ||
cosoleResp('Local', absPath); | ||
return buff; | ||
} | ||
var charset = isUtf8(buff) ? 'utf8' : 'gbk'; | ||
//允许为某个url特别指定编码 | ||
var outputCharset = param.charset; | ||
if(param.urlBasedCharset && param.urlBasedCharset[longestMatchPos]){ | ||
outputCharset = param.urlBasedCharset[longestMatchPos]; | ||
} | ||
cosoleResp('Local', absPath); | ||
return adaptCharset(buff, outputCharset, charset); | ||
} | ||
} | ||
@@ -190,0 +192,0 @@ return null; |
{ | ||
"name": "flex-combo", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"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).", | ||
@@ -5,0 +5,0 @@ "main": "flex-combo.js", |
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
82255
1588