Project
Project can be created by calling tron.createProject().
Project API
addBuildItem()
Add single BuildItemg item to the project, after resolving it with following actions.
- Create RTB instance connected to it.
- If project prefix is specified, it is prepended to buildItem.name. (to avoid gulp task name collision)
- Create a gulp task, named with prefixed buildItem.name, and bind it with buildItem.builder.
BuildItem is typically BuildConfig, but it can also be CleanerConfig or WatcherConfig.
addBuildItems()
Add single or multiple BuildItem objects to the project.
addWatcher()
Create watcher task which monitors all the watch targets of each build items in the project. Watch targets for each BuildConfig items are determined by the following rules:
- If conf.watch is specified, add it to watch target.
- If conf.watch is not specified, conf.src is added to watch target.
- If conf.watch is set to empty array([]), then conf.src is not added to watch target.
- If conf.addWatch is specified, add it to watch target.
If the argument, config, is string, then it is understood as gulp task name.
config properties
- config.watch: additional watch targets (string | strinig[]). Glob is supported.
- config.browserSync: browser-sync module options.
- config.livereload: livereload module options.
If config.browserSync or config.livereload propertiers are set, then browserSync or livereload are are activated.
addCleaner()
Create cleaner task which cleans all the clean targets of each build items in the project. Clean targets of each BuildConfig items are specified in its conf.clean property.
If the argument, config, is string, then it is understood as gulp task name.
config properties
- config.clean: additional clean targets (string | strinig[]). Glob is supported.
addVars()
Add key/value pairs into project-wide variable list, which is accessible using project.vars property. This is typically used to deliver project specific data to other modules in multi-project environment.
Example
getBuildNames()
Returns the list of build names that matches the selector pattern from the build items inside the project.
Project Properties
projectName
Type: : string
projectName specified in ProjectOptions when the project instance is created. If not not available, empty string "" is returned.
rtbs
Type: RTB[]
Array of RTB instances created by build items in the project.
prefix
Type: string
prefix specified in ProjectOptions specified when the project instance is created.
vars
Type: {[key:string]: any}
Object with key/value pairs which were added by addVar() function. Typically, used to share data between projects and GBuildManager in multi-file projects.