-
Notifications
You must be signed in to change notification settings - Fork 8
Home
#Developer API description
This task is the main entry point for the build plugin. It does the following:
-
Normalize the config. The config property in the Gruntfile is either
amdBuild
or the task first argument (ie,configProp
if the taskamdBuild:configProp
is run) -
Select the tasks to run according to the config provided in the Gruntfile (minification, inlining of plugin resources...)
-
Create a grunt config object to store internal data and normalized config. It will be named
configProp_api
. -
Apply the tasks list for each layer. The tasks will be run as
task:configProp:layerName
configProp_api
at the end of the task:
{
normalized copy of grunt config,
pkgs, //normalized packages with main and location
layers, //normalized layers with include, exclude, output path
// and include contains the layer name.
}
This task lists all the modules and plugins dependencies of a layer. This task MUST be run first, before any other tasks.
-
List the modules to exclude (the ones in the
configProp_api.layers.layerName.exclude
array and their dependencies) -
List all the modules and plugins to include, and store them in
configProp_api
configProp_api
at the end of the task:
{
...
layers: {
layerName: {
modules: {
mid: {
mid: "",
content: “”,
deps: [],
includeDeps: [],
filepath: “”
}
},
plugins: {
mid: [“resource”, “...”],
...
},
include: [...],
exclude: [...],
outputPath: “...”
},
...
},
}
This task relies on the AMD plugin api by RequireJS (http://requirejs.org/docs/plugins.html). It is used to inline plugin resources at build time. The inlined resources are then added to the modules object.
This task writes all the module from the modules object to the outputPath
layer.
This task writes the uglify configuration and call the uglify grunt task.