An add-on for the Asset Pipeline Plugin that understands how to resolve file dependencies for Sencha Ext JS applications.
Note: This plugin requires asset-pipeline version 1.8.9 or higher! (For more info, see this pull request.) |
This plugin can handle JavaScript files as well as CoffeeScript (via the bundled coffee-asset-pipeline plugin ). It parses the files in your Ext JS application folder (and subfolders) and builds a mapping of file names to Sencha class names, as well as what other files each file requires.
It will:
- Handle arrays of class names declared in the
requires:
property of a class. - When using CoffeeScript, it should properly handle arrays using commas or arrays that omit commas by defining each element on a separate line.
- Implicitly require any class name declared in the
extend:
oroverride:
property of a class. - Require class names declared using
Ext.require()
andExt.syncRequire()
. (Note that required class names must be declared inline, and cannot be a variable, as there is no way to evaluate what the runtime value of the variable will be.) - Require the correct file(s) even when using an alternate class name (defined in the
alternateClassName:
array in a class). - Determine the correct required files even when multiple classes are defined in a single file.
- It should even handle classes required by the
@require()
Sencha Cmd annotation.
Other than installing the plugin, the only other config option is to set a grails.assets.sencha.appRootPath
in your Config.groovy
file. This lets the plugin know what your Sencha application's root is. It's a relative path from your assets/javascripts
folder.
For example, if your app is located at:
grails-app/assets/javascripts/app
then you'd set this config option to:
grails.assets.sencha.appRootPath = "app"
By default, it will treat your assets/javascripts
folder as the app root.