injectjs
v1.0.1
Published
** injectJS **
Downloads
4
Readme
** InjectJS **
InjectJS
InjectJS
Usage
// Module MyApp2
//É adicionado esse import <script type="text/javascript" src="br/com/domain/util.js"></script>
inject.define("MyApp2", ["br.com.domain.util", function(util){
alert(util.withoutPoint('com.teste'));
}]);
// Module br.com.domain.util
inject.define("br.com.domain.util", [function(){
var withoutPoint = function (str) {
return str.replace(/\./g, '_');
};
return {
withoutPoint : withoutPoint
}
}]);
// path br/com/domain/util/base64.js
inject.define("com.domain.util.base64", [function(){
return {
encode : function () {
return "Base64 ....";
}
}
}]);
// path br/com/domain/util/md5.js
inject.define("com.domain.util.md5", [function(){
return {
encode : function () {
return "teste ....";
}
}
}]);
// path br/com/domain/util/soma.js
inject.define("com.domain.util.soma", [function(){
return function (n1, n2) {
return n1 + n2;
}
}]);
//É adicionado esse import <script type="text/javascript" src="br/com/domain/util/base64.js"></script>
inject.define("Main1", ["com.domain.util.base64",
function(base64){
console.warn('Main1', base64.encode());
}]);
//É adicionado esse import <script type="text/javascript" src="br/com/domain/util/soma.js"></script>
inject.define("Main2", ["com.domain.util.soma",
function(soma){
console.warn('Main2', soma(5, 2));
}]);
//É adicionado esse import <script type="text/javascript" src="br/com/domain/util/md5.js"></script>
inject.define("Main3", ["com.domain.util.md5",
function(md5){
console.warn('Main3', md5.encode());
}]);
DIST
node injectJS/build/app.js /path/js/ 'core.main' dist/path/main-min.js