wiki:builds

Building JS Resources

GeoExt code is structured with one file per component. In some applications, it may be appropriate to include the entire library. In other applications, only a limited subset of the library may be needed. The core contains a build directory with a sample configuration for concatenating/minifying (building) the code needed for your application.

Using jsbuild

jsbuild is a command line utility for building JavaScript resources that comes with the JSTools suite. You can install jsbuild with Python setuptools:

$ easy_install http://svn.opengeo.org/jstools/trunk/

After installing jsbuild, you can use the following syntax to build your JavaScript resources given a configuration file.

Full build

Change into the core/trunk/build directory and run the following:

$ jsbuild full.cfg

Verbose output

To get some more detail on what is being included in your build, use the -v option:

$ jsbuild full.cfg -v

Single section

The build config files contain multiple sections. The full.cfg file contains sections for GeoExt.js and ext.js. To build only one of the sections, use the -s option:

$ jsbuild full.cfg -s GeoExt.js

Different output path

By default, the resulting scripts will be created in the same directory as the config file. Use the -o option to specify a different path for the output:

$ jsbuild full.cfg -o ../path/to/output

More

Of course, the above options can be used in any combination. For additional documentation, see the JSTools site.

Custom builds

The jsbuild docs describe the configuration syntax that lets you specify what files to include, any files to exclude, and any special files that need to be included first or last. The GeoExt library will include directives in comments in the source to automatically include any dependencies. So, if one component extends another, your build profile only needs to reference the child, and the parent will be included in the build.

The ExtJS library does not use @requires or @include directives in the source comments. So, the configuration for building ext.js explicitly lists files in the order they need to be present. If you wish to exclude any files from your ext.js build, use a # to comment out the appropriate line in your build configuration.

E.g.

    #widgets/Slider.js

Note that there are many non-obvious dependencies in the ExtJS code base. You may find the custom build by trial and error a bit frustrating. See the online build tool provided by ExtJS for an alternative.

Last modified 9 years ago Last modified on 12/10/08 23:21:21