diff --git a/lib/core/config.js b/lib/core/config.js index 8daeaaa4a..6128ab452 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -229,7 +229,7 @@ Config.prototype.loadFiles = function(files) { // get embark.js object first originalFiles.filter(function(file) { - return file.indexOf('.') >= 0; + return (file[0] === '$' || file.indexOf('.') >= 0); }).filter(function(file) { if (file === 'embark.js') { @@ -249,6 +249,9 @@ Config.prototype.loadFiles = function(files) { readFiles.push({filename: 'embark.js', content: fs.readFileSync(fs.embarkPath("js/build/embark.bundle.js")).toString(), path: fs.embarkPath("js/build/embark.bundle.js")}); } + if (file === '$EMBARK_JS') { + readFiles.push({filename: '$EMBARK_JS', content: fs.readFileSync(fs.embarkPath("js/build/embark.bundle.js")).toString(), path: fs.embarkPath("js/build/embark.bundle.js")}); + } if (file.indexOf("web3-") === 0) { let web3Version = file.split('web3-')[1].split(".js")[0]; npm.getPackageVersion('web3', web3Version, function(web3Content) { diff --git a/lib/pipeline/pipeline.js b/lib/pipeline/pipeline.js index eb2e33d0c..cc38832dc 100644 --- a/lib/pipeline/pipeline.js +++ b/lib/pipeline/pipeline.js @@ -25,6 +25,8 @@ class Pipeline { if (file.filename === "$ALL_CONTRACTS") { return {content: abi, filename: file.filename, path: file.path, modified: true}; + } else if (file.filename === "$EMBARK_JS") { + return {content: file.content, filename: "embark.js", path: file.path, modified: true}; } else if (file.filename[0] === '$') { let contractName = file.filename.substr(1); return {content: this.buildContractJS(contractName), filename: contractName + ".js", path: file.path, modified: true}; diff --git a/test_app/embark.json b/test_app/embark.json index 8f1ee41e7..2b275be5a 100644 --- a/test_app/embark.json +++ b/test_app/embark.json @@ -13,7 +13,8 @@ "test2.html": "app/test2.html", "js/myweb3.js": "web3-0.18.js", "js/web3.js": "web3.js", - "js/all_contracts.js": "$ALL_CONTRACTS" + "js/all_contracts.js": "$ALL_CONTRACTS", + "js/only_embark.js": "$EMBARK_JS" }, "buildDir": "dist/", "config": "config/",