Setup a project using delite
The various delite modules can be consumed from two forms:
- the delite built AMD layer
- the delite source AMD modules
In order to install the built form:
bower install delite-build
Similarly, for the source form:
bower install delite
Both commands will install delite and its dependencies in a bower_components
directory. You might want to
additionally use the --production
in order to avoid installing dependencies only needed by tests or for debugging.
Using the source form is as simple as requiring the needed AMD modules using RequireJS:
require.config({
baseUrl: "bower_components"
});
require(["delite/register"], function (register) {
register("my-element", [HTMLElement, Widget], {
//...
});
});
In order to consume the built form you first need to load the corresponding layer and then the AMD modules as follows:
require.config({
baseUrl: "bower_components"
});
require(["delite/layer"], function() {
require(["delite/register"], function (register) {
//...
});
});
When using the source form (or the built form if needed), you can build your resulting application using the grunt-amd-build project.
Alternatively you can use the delite Yeoman generator to setup the project structure.