The upcoming Appcelerator CLI 5.2.1 will include a significant update of Alloy, which is already available if you use the Titanium & Alloy CLI directly from NPM.
This also fixes the breaking change in Titanium SDK 5.2.0 that caused
platform directories in Alloy Themes and Widgets to no longer be used.
Everything Alloy controls is now under ‘app’
This update changes the location of your
/platform source directories for Alloy. These used to live in your project root, just like they do for classic Titanium projects. Starting with Alloy 1.8 they are now expected to be at
When you build your app, Alloy will generate the root
/platform directories, just like it generates the
/Resources directory. Any manual change to files in these directories will be lost during the next build.
What this means for existing Alloy projects
Existing Alloy projects that already have
/platform directories in the project’s root directory that have not been generated by Alloy will fail to build until you have moved these directories into the
/app directory, saying:
Detected legacy "/i18n" directory in project directory. Please move the "/i18n" directory to "/app/i18n" for Alloy 1.8.0 or later. Detected legacy "/platform" directory in project directory. Please move the "/platform" directory to "/app/platform" for Alloy 1.8.0 or later.
Rest assured that Alloy will not delete these directories if they don’t contain the
alloy_generated file, which they would have if they were generated.
Alloy will also warn if the generated directories are missing in your
Generated "/i18n" directory is not in ignored by Git, please add it to your .gitignore Generated "/platform" directory is not in ignored by Git, please add it to your .gitignore
What this means for new Alloy projects
When you run
[appc] alloy new to upgrade a classic Titanium project to Alloy or when you create a new project using one of our Alloy templates, Alloy will move the
/platform directories into
/app for you and make sure the generated directories are ignored.
Refreshing how i18n and platform directories under Themes & Widgets work (again)
With this update you can once again override i18n strings and platform resources via Alloy Themes and Widgets. Let’s refresh our memory on how that works.
When you build your app, Alloy will first delete
/platform and then generate new directories, sourcing from the following paths:
/app/widgets/my.widget/i18n(not overriding strings)
<platform> being the platform you build for:
Be aware that the i18n XML files are merged, while the platform resources simply overwrite each other.
Also notice that although i18n strings from widgets come last, they won’t override existing strings. This means you can override strings from (third-party) widgets via your theme or main i18n files.
Code Strong! 🚀