node-cube
Advanced tools
Comparing version 0.1.5 to 0.1.7
11
index.js
@@ -76,2 +76,5 @@ /*! | ||
*/ | ||
if (this.config.compress === undefined) { | ||
this.config.compress; | ||
} | ||
this.processors = { | ||
@@ -128,2 +131,10 @@ map: { | ||
Cube.prototype.getType = function (fpath) { | ||
var ext = fpath.match(/\.\w+$/); | ||
if (!ext) { | ||
return null; | ||
} | ||
ext = ext[0]; | ||
return this.processors.map[ext]; | ||
}; | ||
/** | ||
@@ -130,0 +141,0 @@ * register a processor for cube |
@@ -227,2 +227,10 @@ /*! | ||
} | ||
function genUncompressCode(head, code, foot, release) { | ||
if (release) { | ||
return head + '\n' + code + '\n' + foot; | ||
} else { | ||
return head + code + foot; | ||
} | ||
} | ||
/** | ||
@@ -448,3 +456,2 @@ * update require path for dev model | ||
} | ||
} | ||
@@ -481,2 +488,7 @@ | ||
node.args[0].value = abspath; | ||
// auto | ||
if (cube.getType(abspath) === 'style' && node.args.length === 1) { | ||
node.args[1] = new ug.AST_String({value: ''}); | ||
requiresMap[line].push({col: node.args[0].start.col + v.length + 1, offset: 0, name: ',""'}); | ||
} | ||
} | ||
@@ -534,3 +546,8 @@ }); | ||
} else { | ||
returnObj.code = header + transferRequire(code, requiresMap) + footer; | ||
returnObj.code = genUncompressCode( | ||
header, | ||
transferRequire(code, requiresMap), | ||
footer, | ||
options.release | ||
); | ||
} | ||
@@ -537,0 +554,0 @@ callback(null, returnObj); |
@@ -5,3 +5,3 @@ { | ||
"description": "a new way to write js in browser", | ||
"version": "0.1.5", | ||
"version": "0.1.7", | ||
"homepage": "https://github.com/fishbar/cube", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -251,4 +251,3 @@ /*! | ||
/** | ||
* [_loaded description] | ||
* @return {[type]} [description] | ||
* the module without require | ||
*/ | ||
@@ -381,3 +380,3 @@ _leafMod: function (cb) { | ||
rename = rename ? rename : 'Cube'; | ||
rename = rename || 'Cube'; | ||
if (HOST[rename]) { | ||
@@ -384,0 +383,0 @@ console.log('window.' + rename + ' already in using, replace the last "null" param in cube.js'); |
@@ -130,3 +130,3 @@ var xfs = require('xfs'); | ||
sourceMap: false, | ||
compress: true, | ||
compress: cube.config.compress, | ||
release: cube.config.release, | ||
@@ -133,0 +133,0 @@ root: cube.config.root, |
Sorry, the diff of this file is not supported yet
264772
2769