titanium 入门 6 alloy.jmk: 编译配置文件
访问量: 3336
jmk = js MakeFile , 用来在编译 javascript 时做配置。 需要放在 app 目录下。
例子:
task("pre:compile",function(event,logger){ logger.showTimestamp = true; logger.info('building project at '+ event.dir.project); }); task("post:compile",function(event,logger){ logger.info('compile finished!'); });
接受两个参数: event, logger.
可用的event:
pre:load: called after the project is cleaned and before copying any assets to the Resources folder.
pre:compile: called before the compiler starts.
post:compile: called after the compiler finishes but before it exits.
compile:app.js: called just after the compilation of the main app.js file but before the code is written to disk.
在function(event, logger) 中, event有如下的变量:
Object/Value |
Description |
adapters |
List of adapters. |
alloyConfig |
Contains Alloy compiler configuration information.
|
autoStyle |
If set to true, autostyle is enabled for the entire project. |
dependencies |
Value of the dependencies key in the config.json file. |
dir |
Contains directory paths to various resources.
|
sourcemap |
If true, generates the source mapping files for use with the Studio debugger and other functions. |
theme |
Name of the theme being used. |
code |
Only present for the compile:app.js task. Contains the contents of the app.js file. |
appJSFile |
Only present for the compile:app.js task. Contains the the absolute path to the app.js file. |