Propeller
Propeller is a simple and lightweight Gulp plugin that allows you to compile and deploy your projects using easy-to-read configuration files. Compilers are used to build your project, while deployers are used to push files to both local and remote environments.
Getting Started
Install Propeller using npm:
npm install gulp-propeller --save-dev
Create a propeller.json
file in your project directory:
Use Propeller in any Gulp task:
const gulp = ;const propeller = ; gulp;
Compilers
Compilers are used to build your project in preparation for deployment. Configure compilers by adding tasks
to your propeller.json
file:
Run all tasks in sequential order using propeller.run
:
propeller;
Some compilers may yield a different output when in production mode. For example, a production build may include minified files for optimized performance. Run gulp tasks with the --production
flag to enable production mode in all Propeller compilers.
Core Compilers
Propeller includes several core compilers that are available by default.
concat
Compiler
Concatenate files into a single file at the target location. Use a comma-separated array syntax to specify all source files in order.
Configuration
copy
Compiler
Copy files from one location to another.
Configuration
sass
Compiler
Compile Sass stylesheets to CSS.
Configuration
Production Mode
By default, compiled CSS stylesheets include Sass sourcemaps and expanded CSS style declarations. In production mode, the Sass compiler uses gulp-autoprefix to automatically add vendor prefixes to your CSS styles. In addition, the CSS output is compressed and minified for optimal performance.
webpack
Compiler
Compile ES6 files into client-ready ES5 using the Babel preset for webpack.
Configuration
Production Mode
Babili is used in production mode to minify the compiled scripts for better performance.
Deployers
Deployers are used to move project files to a target environment. Configure deployers by adding environments
to your propeller.json
file:
Deploy to a target environment using propeller.deploy
:
propeller;
Chain deployments to compiler tasks to create a sequential build/deploy sequence:
propeller;
Core Deployers
Propeller includes several core deployers that are available by default.
file
Deployer
Deploy assets using the file system.
Configuration
ftp
Deployer
Deploy assets using the file transfer protocol (FTP). This deployer requires a connection
object to be included in the environment definition within propeller.json
(see below for examples).
The FTP deployer utilizes vinyl-ftp to handle file transfers. See https://www.npmjs.com/package/vinyl-ftp#ftpcreate-config- for additional connection configuration options.
Configuration
sftp
Deployer
Deploy assets using the secure file transfer protocol (SFTP). This deployer requires a connection
object to be included in the environment definition within propeller.json
(see below for examples).
The SFTP deployer utilizes gulp-sftp to handle file transfers. See https://www.npmjs.com/package/gulp-sftp#api for additional connection configuration options.
Configuration
Extending Propeller
Propeller is built to be highly extensible. Create custom compilers and deployers to add new capabilities to your Propeller projects.
Custom Compilers
Extend propeller.Compiler
and pass an instance of your extended class to propeller.extend
to register a custom compiler.
const gulp = ;const propeller = ; Compiler /** * Compile source to destination: * Override this method to write your own compiler. * Return a Gulp stream to properly close this method. * * @param * @param * @return */ { // do stuff } // extend propellerpropeller;
Custom compilers should include a compile
method that returns a Gulp stream object upon closure.
Utilize custom compilers by adding them to your task list. Always use the lower-case class name of your custom compiler when creating tasks. For example, the custom Coffee
compiler becomes coffee
in our propeller.json
task list:
Custom Deployers
Extend propeller.Deployer
and pass an instance of your extended class to propeller.extend
to register a custom deployer.
const gulp = ;const propeller = ; Deployer /** * Deploy source to destination: * Override this method to write your own deployer. * The connection parameter is optional. * Return a Gulp stream to properly close this method. * * @param * @param * @param * @param * @return */ { // do stuff } // extend propellerpropeller;
Custom deployers should include a deploy
method that returns a Gulp stream object upon closure. Optionally employ the connection
parameter in the deploy
method to pass custom JSON configuration data to your deployer.
Utilize custom deployers by referring to them in your environments list. Always use the lower-case class name of your deployer in configuration files. For example, the custom WebDav
deployer becomes webdav
in our propeller.json
environments list: