flex-combo
Advanced tools
Comparing version 0.7.7 to 0.7.8
28
api.js
@@ -126,2 +126,8 @@ var urlLib = require("url"); | ||
/* TPL动态编译 */ | ||
function tplCompiler(htmlfile, url) { | ||
var jstpl = require("./engines/jstpl"); | ||
return jstpl.call(this, htmlfile, url); | ||
} | ||
/** | ||
@@ -209,6 +215,11 @@ * FlexCombo类 | ||
{ | ||
rule: "\\.jpl$|\\.jpl\\.js$", | ||
func: function (htmlfile, url) { | ||
return tplCompiler(htmlfile, url); | ||
} | ||
}, | ||
{ | ||
rule: "\\.html\\.js$", | ||
func: function (htmlfile, url) { | ||
var jstpl = require("./engines/jstpl"); | ||
var content = jstpl.call(this, htmlfile, url); | ||
var content = tplCompiler(htmlfile, url); | ||
if (content) { | ||
@@ -251,3 +262,3 @@ fsLib.writeFile(htmlfile, convert.call(this, content)); | ||
} | ||
this.addEngine(k, require(pathLib.join(process.cwd(), engines[k]))) | ||
this.addEngine(k, require(pathLib.join(process.cwd(), engines[k]))); | ||
} | ||
@@ -257,5 +268,12 @@ } | ||
if (URL.match(new RegExp(suffix.join('|')))) { | ||
var U4M = URL; | ||
if (URL.match(/\.less$|\.scss$|\.sass$/)) { | ||
U4M += ".css"; | ||
} | ||
else if (URL.match(/\.jpl$/)) { | ||
U4M += ".js"; | ||
} | ||
res.writeHead(200, { | ||
"Access-Control-Allow-Origin": '*', | ||
"Content-Type": mime.lookup(URL) + (isBinFile(URL) ? '' : ";charset=" + this.param.charset), | ||
"Content-Type": mime.lookup(U4M) + (isBinFile(URL) ? '' : ";charset=" + this.param.charset), | ||
"X-MiddleWare": "flex-combo" | ||
@@ -359,3 +377,3 @@ }); | ||
if (buff) { | ||
var suffix = engine.rule.replace(/^\\./, '').split("\\."); | ||
var suffix = engine.rule.replace(/^\\.|\$/g, '').split("\\."); | ||
this.param.debug && Log.engine(_url, absPath.replace(new RegExp(engine.rule), '.' + (suffix[0] || "unknown"))); | ||
@@ -362,0 +380,0 @@ } |
{ | ||
"name": "flex-combo", | ||
"version": "0.7.7", | ||
"version": "0.7.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).", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
43268
735