cake-gulp
Stuff your face with all those wonderful Gulp plugins from your Cakefile!
tempgulp4
as Gulp 4 has not yet officially released at the time of this writing.
WARNING: This is a preview release. This branch uses cake-gulp
integrates cake
's descriptive build task system and commandline argument parsing into gulp tasks, allowing for clean descriptive task management.
cake-gulp
also includes some common gulp plugins that relate directly to coffeescript, file management, or vynil/stream management but do not directly impose any framework or specific build paradigm on you. These plugins are useful for general filesystem manipulation, flow control of streams, information and logging, or incremental builds. These plugins where chosen because of their general usefulness in just about any build process regardless of what you are doing, things that are used so often they are practically a part of Gulp.
Example:
# This Cakefile incrementally transpiles .coffee files # to one combined minified javascript file with sourcemaps # `npm install -save-dev cake-gulp` # `cake build` # `cake -w build` for watching incremental builds pack = require './package.json'gulp = require 'cake-gulp'distDirectory = "/dist" task 'build:clean''Cleans all generated or temporary files.'-> gulpdelete distDirectory coffeeSources = "/src/**/*.coffee"task 'build:coffee''Transpiles .coffee → .js with sourcemaps'-> gulpsrc coffeeSources pipe gulpcached pipe gulpsize title: 'coffee'showFiles: yes pipe gulpsourcemapsinit pipe gulpcoffee pipe gulpremember pipe gulpconcat ".min.js" pipe gulpuglify pipe gulpsourcemapswrite '.' pipe gulpsize title: 'coffee → javascript'showFiles: yesgzip: yes pipe gulpduration 'coffee' pipe gulpdest distDirectory pipe gulpgzip pipe gulpdest distDirectory option '-w''--watch''Watch for file changes for build tasks.'task 'build''Build all the things! -w to watch for changes.' gulpseries 'build:clean''build:coffee' # `gulp.options` is from cake's option parsing of commandline options if gulpoptionswatch gulplog " " gulpwatch coffeeSourcesgulpseries 'build:coffee' callback
cake
Globals fromtask("name", "description", (callback) -> )
task
has been modified to accept both a stringname
and a stringdescription
, but other then adding the description, task is no different from undertaker task which is what Gulp4 uses for it's task manager.async-done
is used for the callback function, and it is also fairly common to passgulp.series
orgulp.parallel
in instead of a(callback) ->
function to execute tasks in a series, or at the same time. cake'soptions
object that would usually get passed in is nowglobal.options
orgulp.options
and is only available inside a task function.invoke(name)
runs a single task (by name string only) currently. This only invokescake
tasks and currently will not work if you usegulp.task
option("-a", "--argument [ARG]", "description")
is useful for commandline parsing and is cake'soption
function.global.options
orgulp.options
is where you access your commandline arguments. Because Gulp/Undertaker does not handle commandline options, these are not passed in to task functions like in cake. Keep in mind thatoptions
is still only available after a task function is invoked.
Gulp Plugins and Utilities
cake-gulp
comes with some common generic gulp plugins that should be useful in just about any build process. All gulp plugins are bound to the gulp
object.
Coffeescript and Sourcemaps
CSON
is a global likeJSON
but for Coffeescript. You may also wish to userequire("./something.cson")
- gulp.sourcemaps you may wish to check out this wiki for compatable sourcemap gulp plugins!
- gulp.coffee
- gulp.uglify
File Manipulation
Incrimental Builds
Stream Flow Control
- gulp.series
- gulp.parallel
- gulp.upon or gulp.if
- gulp.foreach
- gulp.merge
- gulp.combine
- gulp.source
- gulp.buffer