The JSMin processor has the possibility to @import other resources. Those "other resources" normally are other JS/JSMin resources (type javascript).
We now added the following feature:
If a resource of type "tmlscript" is @import-ed the tmlscript is executed and the result is imported.
The tmlscript should either return a String or a native JS-Object. If a JS-Object is returned it will be converted to a JSON-String.
Sample:
// sample.jsmin
//@import type=tmlscript get-version
// get-version.tmlscript:
return 'var WGAversion="' + WGA.server().version + '";'
// resulting JS-Code
var WGAversion = "7.5.3 Build 669";
Sample 2:
// sample.jsmin
var CMS =
//@import type=tmlscript get-version
// get-version.tmlscript:
return {
version: WGA.server().version
}
// resulting JS-Code
var CMS =
{"version": "7.5.3 Build 669"}