Back

titanium 入门 3 Alloy: 惯例优于配置( convention over configuration)

发布时间: 2014-12-24 09:34:00

alloy 框架跟Rails特别像: 

app

Contains the models, views, controllers and assets of the application. All work should be done here. See folder descriptions below.

app/alloy.jmk

Build configuration file.
See Build Configuration File (alloy.jmk).

app/alloy.js

Initializer file used to preconfigure components or override Alloy methods before the main controller is executed.
See Initializer File (alloy.js) for more information.

app/config.json

Project configuration file.
See Project Configuration File (config.json).

app/assets

Contains image assets and other files that need to be copied into the Resources directory.
Reference these files in the code without the 'app/assets' path and without the platform-specific if it is inside one.

app/controllers

Contains controllers in the format filename.js to a corresponding view file app/views/filename.xml.
See Alloy Controllers for more information.

app/lib

Contains application-specific library code, typically in the CommonJS format.
See Library Code for more information.

app/migrations

Contains database migration files in the format <DATETIME>_filename.js.
See Migrations for more information.

app/models

Contains model files in the format filename.js.
See Alloy Models for more information.

app/styles

Contains view styling in the format filename.tss, which is applied to a corresponding view file app/views/filename.xml.
See Titanium Style Sheets for more information.

app/themes

Contains themes to customize the assets and styles of the entire GUI.
See Themes for more information.

app/views

Contains views in the format filename.xml with the optional corresponding files app/controllers/filename.js and app/styles/filename.tss.
See Alloy XML Markup for more information.

app/widgets

Contains widget files. Each widget will have its own app-like directory structure.
See Widgets for more information.

i18n

Contains internationalization and localization files. Same usage as with a Titanium application.
See Internationalization for more information.

Resources

Contains the Titanium files generated by the Alloy interface from the app directory. All files will be overwritten each time the application is built.
Since Alloy 1.3.0, Alloy creates a separate Titanium project for each platform you build for in the Resources/<platform> folder.
See Compilation Process for more information.

Back