Process JS using template, add support for unique statics in repeat lime.embed calls
This commit is contained in:
15
templates/html5/output.js
Normal file
15
templates/html5/output.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// lime.embed namespace wrapper
|
||||
(function ($hx_exports, $global) { "use strict";
|
||||
$hx_exports.lime = $hx_exports.lime || {};
|
||||
$hx_exports.lime.$scripts = $hx_exports.lime.$scripts || {};
|
||||
$hx_exports.lime.$scripts["::APP_FILE::"] = (function(exports, global) {
|
||||
::SOURCE_FILE::
|
||||
});
|
||||
// End namespace wrapper
|
||||
$hx_exports.lime.embed = function(projectName) { var exports = {};
|
||||
$hx_exports.lime.$scripts[projectName](exports, $global);
|
||||
for (var key in exports) $hx_exports[key] = $hx_exports[key] || exports[key];
|
||||
exports.lime.embed.apply(exports.lime, arguments);
|
||||
return exports;
|
||||
};
|
||||
})(typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this, typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this);
|
||||
@@ -79,6 +79,14 @@ class HTML5Platform extends PlatformTarget {
|
||||
|
||||
}
|
||||
|
||||
if (FileSystem.exists (outputFile)) {
|
||||
|
||||
var context = project.templateContext;
|
||||
context.SOURCE_FILE = File.getContent (outputFile);
|
||||
System.copyFileTemplate (project.templatePaths, "html5/output.js", outputFile, context);
|
||||
|
||||
}
|
||||
|
||||
if (project.targetFlags.exists ("minify") || type == "final") {
|
||||
|
||||
HTML5Helper.minify (project, targetDirectory + "/bin/" + project.app.file + ".js");
|
||||
|
||||
Reference in New Issue
Block a user