Concept

gulp-tron basically focuses on two main features of gulp, task management and file streams. gulp-tron extends those two features by providing users with configuration capability which simplicifies task management and input to output file stream processing.

Typical Node project invloves multiple gulp tasks with parallel or serial dependencies. Sometimes, projects may consist of multiple sub-projects pursuing modular architecture. gulp-tron supports this by providing the concept of project. Effectly, gulp-tron is a colllection of gulp projects.

Project

Project is basically a collection of resolved BuildConfig items to achieve common project objectives. Here, 'resolved' means each BuildConfig properties are processed and relevant gulp tasks and the RTB instances are created accordingly. Cleaners and Watchers are special kind of BuildConifg items that can be added to the project.

BuildConfig, Cleaner, and Watcher items are resolved when they are added to the project. Typically they are added to project when the project is created, but it is also possible to add them later as necessary. In a single project, multiple cleaners or watchers can be added if necessary, even though it is not common. Cleaners and Watchers are specific to each projects and will work only for the build items within the same project scope.

gulp-tron project can be created by calling tron.createProject().

BuildItem

Independent configuration object for creating gulp task and defining build process. Currently, following three types of BuildItem are available.

BuildConfig

Configuration to define gulp task and the build process. It defines gulp task name to be created and optional properties that would be used during the build process execution.

CleanerConfig

Configuration to define cleaner task. This is a special kind of BuildConfig with builder property set to 'cleaner'.

WatcherConfig

Configuration to define watcher task. This is a special kind of BuildConfig with builder property set to 'watcher'.

Builder

Object defining entry point of the gulp task to be executed. Following builder types are available. Refer to builders section for more details.

Builder TypeDescription
BuilderClassNameClass name of built-in builder classes or the name of custom class inherited from GBuilder class. For custom class name, refer to gulp-tron section and see 'customBuilderDirs' project option.
BuildFunctionFunction to be executed.
ExternalCommandObject with external command and command line arguments.
GBuilderGbuilder or classe instance derived from it.
'cleaner'Literal string 'cleaner' which means built-in Clearner.
'watcher'Literal string 'watcher' which means built-in Watcher.

BuildSet

List of gulp task executables to define build task dependencies.

BuildSet ElementDescription
BuildNameGulp task name
GulpTaskFunctionGulp task function that can be used in gulp.task() function.
BuildItemgulp-tron build configuration
BuildSetSeriesList of BuildSet elements that will be executed in series
BuildSetParallelList of BuildSet elements that will be executed in parallel

BuildSet is a recurrsive collection type which can contain itself as its own element. This is used in BuildConfig to define task execution dependencies.

RTB

RTB means Runtime Builder. It contains following items.

  • A name combined to gulp task that was successfully created
  • A build function that is to be executed by the combined gulp task
  • All the information required in the build process
  • API to help build process implementation

RTB is created when BuildConfig item is resolved (effectively, at the point BuildItem is added to a project). It has one-to-one mapping to gulp task, and available to all the build functions as frist argument.

Note that RTB is created automatically by gulp-tron, and not meant to be created by user. It is automatically created, and automatically available to all the build processing functions as first argument.

All the RTB API functions return RTB object itself to support call chaining such as rtb.src().debug({}).dest()...