gump

0.1.2 • Public • Published

Gump

Gump is the task runner that keeps on running. It watches your files and if you're working on a client-side app, serves and live reloads them automatically, giving you notifications. It's like Brunch or Mimosa - while keeping you in full control.

{taskwatchserve} = require 'gump'
coffee = require 'gulp-coffee'
stylus = require 'gulp-stylus'
jade = require 'gulp-jade'
 
task 'default'['js''css''templates']->
  serve 'bin'
 
watch 'js',
  'src/js/**/*.coffee'
  -> coffee()
  'bin/js'
 
watch 'css',
  'src/css/**/*.styl'
  -> stylus()
  'bin/css'
 
watch 'templates',
  'src/**/*.jade'
  -> jade()
  'bin'

Yes, it's just a nice wrapper for gulp.

Examples

Full-fledged examples, ready to run:

Documentation

Piece these together to make up your build.

Serving

serve uses browser-sync, just give it the top directory of your app and it will open a browser window with the app running.

task 'default'['js''css']->
  serve 'bin'

Watching and Live Reload

Whenever you change a sourcefile, watch will run the given pipeline only on that file. If you're using serve and that file ends up in the served directory the browser will auto reload (or just update in case of images and CSS).

watch 'js',
  'src/js/**/*.coffee'
  -> coffee()
  'bin/js'

If you don't want to reload the web page when a file is changed, output it outside the served directory.

watch 'js',
  'src/js/**/*.coffee'
  -> coffee()
  'build/js'

This is useful when you need intermediate files. For example, Browserify combines all your Javascript into a single file (I recommend using RequireJS instead). We point watch at the main file and the browser will reload only when the whole bundle has finished compiling. this is broken, seriously, use RequireJS instead

watch 'browserify',
  'build/js/app.js'
  -> browserify()
  'bin/js/'

watch also automatically fixes errors with gulp-plumber.

Deleting sources

Gump remembers built files and deletes them if you delete the corresponding source.

Copying

By ommitting any gulp plugins you can simply copy files from one location to another.

watch 'lib',
  'src/js/lib/**/*.js'
  'bin/js/lib'

Plain Task

If you don't need to watch the sources, just use a task. Notice here that plugin sources work as well.

task 'bower',
  -> bower()
  'bin/js/lib'

No Output

If you need more source locations for one task, include them as consecutive arguments (not an array). Options to gulp.src can be passed in after the source location. If you don't want to pipe the transformed files anywhere, don't include a destination.

task 'clean',
  'build''bin'read: false
  -> clean()

See the gulp documentation for more details on its API.

Special thanks to @lachenmayer for the initial syntax idea.

Readme

Keywords

Package Sidebar

Install

npm i gump

Weekly Downloads

1

Version

0.1.2

License

ISC

Last publish

Collaborators

  • xixixao