Quick Start
Let's create a single page website with scss and javascript/babel support. The project directory would look like this.
Package install
First, install gulp and gulp-tron using npm command.
Gulpfile.js
Now let's create a gulpfile.js in the project root directory with following contents.
This configuration will create following 5 gulp tasks with browser reloading support:
- scss: transpile scss files into css files
- babel: transpile javascript with babel support
- @build: execute 'scss' and 'babel' tasks in parallel
- @clean: clean all the files or directories specified in 'clean' properties of each configurations
- @watch: start watch for all the targets specified in 'src' properties of each configurations, and additional target specified by watch property in options to tron.addWatch() function.
Automatic module installation
Automatic dependency modules installation is enabled by default. Default package manager is 'npm', but it can be change to 'yarn' or 'pnpm' using tron.setPackageManager() function. To disable automatic module installation, call tron.setPackageManager({ autoInstall: false}).
For more information on auto-install feature, refer to auto-install section.
Custom build functions
gulp-tron provides various built-in builders such as 'GCSSBuilder' or 'GJavaScriptBuilder'. But if custom build functions are prefered, it can be done like this.
Required node modules can be installed before each build execution using 'npmInstall' proptery. Or, tron.require() function can be used to install the required module automatically when the 'autoInstall' option is enabled.