flex-combo
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -26,3 +26,3 @@ var http = require('http') | ||
host : 'assets.taobaocdn.com', | ||
servlet : '/?', | ||
servlet : '?', | ||
seperator: ',', | ||
@@ -34,3 +34,3 @@ charset: 'gbk', | ||
}, | ||
supportedFile: '\\.js|\\.css|\\.png|\\.gif|\\.jpg|\\.swf|\\.xml', | ||
supportedFile: '\\.js|\\.css|\\.png|\\.gif|\\.jpg|\\.swf|\\.xml\\.less', | ||
prjDir: '' | ||
@@ -61,6 +61,7 @@ }; | ||
function readFromLocal (fullPath) { | ||
console.log('local file:'+ fullPath); | ||
var map = param.urls, charset = param.charset; | ||
var longestMatchNum = -1 , longestMatchPos = null; | ||
for(k in map){ | ||
var matchN = fullPath.indexOf(k); | ||
var matchN = fullPath.replace('\\', '/').indexOf(k); | ||
if(matchN > longestMatchNum) { | ||
@@ -78,2 +79,3 @@ longestMatchNum = matchN; | ||
var absPath = path.normalize(path.join(param.prjDir, dir, revPath)); | ||
console.log('read file:'+ absPath); | ||
if(fs.existsSync(absPath)){ | ||
@@ -129,3 +131,3 @@ var buff = fs.readFileSync(absPath); | ||
//本地没有,从服务器获取 | ||
//console.log('send http request:'+ param.host+ url); | ||
console.log('send http request:'+ param.host+ url); | ||
http.get({host: param.host, port: 80, path: url}, function(resp) { | ||
@@ -145,3 +147,3 @@ var buffs = []; | ||
}).on('error',function(e){ | ||
//console.log('Networking error:' + e.message); | ||
console.log('Networking error:' + e.message); | ||
return; | ||
@@ -152,5 +154,5 @@ }); | ||
prefix = url.substring(0, prefix); | ||
//console.log(prefix+'|'+param.servlet); | ||
console.log(prefix+'|'+param.servlet); | ||
var files = url.substring(prefix.length + param.servlet.length + 1, url.length); | ||
//console.log(files); | ||
console.log(files); | ||
files = files.split(param.seperator, 1000); | ||
@@ -190,6 +192,6 @@ | ||
(function(id) { | ||
//console.log('define request: '+ reqArray[i].file); | ||
console.log('define request: '+ reqArray[i].file); | ||
http.get({host: param.host, port: 80, path: url}, function(resp) { | ||
var buffs = []; | ||
//console.log('request: ' + reqPath+reqArray[id].file); | ||
console.log('request: ' + reqPath+reqArray[id].file); | ||
resp.on('data', function(chunk) { | ||
@@ -205,3 +207,3 @@ buffs.push(chunk); | ||
}).on('error',function(e){ | ||
//console.log('Networking error:' + e.message); | ||
console.log('Networking error:' + e.message); | ||
}); | ||
@@ -208,0 +210,0 @@ })(i); |
{ | ||
"name": "flex-combo", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"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
9266
216