There are two general approaches to resolving this problem:
- Static layer builds - collections of minified and aggregated modules organized into pre-defined layers that are defined by developers
- On-demand module aggregation and minification performed by some server-side process
- Code trimming using has.js feature detection
- Resource Aggregation with dependency expansion to reduce the cascade of requests resulting from dependency discovery as modules are loaded on the client
- A CSS loader plugin that allows LESS/CSS modules to be loaded using AMD
- LESS Compilation
- CSS Optimizations with support for PostCSS plugins
- i18n resource consolidation
- Caching of previously built/minified output for quicker response on subsequent requests with a cache-primer feature allowing the Aggregator cache to be populated prior to deployment.
The Aggregator supports extensibility through the eclipse extension registry which is supported by the OSGi framework. Four extension points are provided. They are:
- com.ibm.jaggr.service.resourcefactory - Provides the ability for third-parties to support resources in alternate repositories such as jar files, databases, etc. By default, the Aggregator supports resources on the server's file system and in OSGi bundles.
- com.ibm.jaggr.service.resourceconverter - Provides the ability for third-parties to support conversion of resources from one source content type to another. The JSX resource converter implements this extension point.
- com.ibm.jaggr.service.httptransport - Enables third parties to provide named HTTP transport implementations. The HTTP transport is the component responsible for extending the client loader, forming the HTTP requests to the server and on the server, for parsing and interpreting the request. The HTTP transport also deals with any loader specific output requirements, such as formatting of the response, etc.
- com.ibm.jaggr.service.serviceprovider - Provides the ability for third-parties to extend the aggregator by registering OSGi services used by the Aggregator. Such services include com.ibm.jaggr.core.IVariableResolver, com.ibm.jaggr.core.options.IOptionsListener and com.ibm.jaggr.core.config.IConigScopeModifier, etc.
A major design goal for the project is that it's use is transparent to the application. This means that the Aggregator does not impose any coding requirements or provide any API for use by the client application (other than requiring a loader config property). If your application is written to use an AMD loader, and that loader supports the loader extension API, then you may start using the Aggregator by providing a bit of config information and loading the script that contains the loader extension code. And you can easily switch between using, or not using, the Aggregator simply by choosing whether or not to load the loader extension code.
Binaries may be downloaded from the project page on OpenNTF
Table of Contents
- Using the Aggregator