Skip to content

Instantly share code, notes, and snippets.

@traviskroberts
Created January 24, 2014 22:02
Show Gist options
  • Save traviskroberts/8607625 to your computer and use it in GitHub Desktop.
Save traviskroberts/8607625 to your computer and use it in GitHub Desktop.
gulp = require 'gulp'
gutil = require 'gulp-util'
# contrib modules
streamee = require 'streamee'
concat = require 'gulp-concat'
coffee = require 'gulp-coffee'
uglify = require 'gulp-uglify'
sass = require 'gulp-sass'
gulp.task 'appScripts', ->
streamee.interleave([
gulp.src(['src/javascripts/**/*.coffee', '!src/javascripts/vendor.js.coffee']).pipe(coffee())
gulp.src('src/javascripts/**/*.js')
])
.pipe(concat 'app.js')
.pipe(uglify())
.pipe(gulp.dest 'assets/javascripts/')
gulp.task 'vendorScripts', ->
gulp.src('vendor/javascripts/**/*.js')
.pipe(concat 'vendor.js' )
.pipe(uglify())
.pipe(gulp.dest './assets/javascripts/')
gulp.task 'styles', ->
gulp.src('src/stylesheets/screen.scss')
.pipe(sass(includePaths: ['vendor/stylesheets']))
.pipe(concat 'screen.css')
.pipe(gulp.dest 'assets/stylesheets/')
gulp.task 'watch', ->
gulp.watch 'src/javascripts/**', (e) ->
console.log "File #{e.path} was #{e.type}, running tasks..."
gulp.run 'appScripts'
gulp.watch 'vendor/javascripts/**/*.js', (e) ->
console.log "File #{e.path} was #{e.type}, running tasks..."
gulp.run 'vendorScripts'
gulp.watch 'src/stylesheets/**', (e) ->
console.log "File #{e.path} was #{e.type}, running tasks..."
gulp.run 'styles'
gulp.task 'default', ['appScripts', 'vendorScripts', 'styles', 'watch']
@traviskroberts
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment