Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
82 lines (63 sloc) 1.97 KB
gulp = require 'gulp'
gutil = require 'gulp-util'
sass = require 'gulp-sass'
browserSync = require 'browser-sync'
coffeelint = require 'gulp-coffeelint'
coffee = require 'gulp-coffee'
concat = require 'gulp-concat'
uglify = require 'gulp-uglify'
clean = require 'gulp-clean'
runSequence = require 'run-sequence'
# CONFIG ---------------------------------------------------------
isProd = gutil.env.type is 'prod'
sources =
sass: 'sass/**/*.scss'
html: 'index.html'
coffee: 'src/**/*.coffee'
# dev and prod will both go to dist for simplicity sake
destinations =
css: 'dist/css'
html: 'dist/'
js: 'dist/js'
# TASKS -------------------------------------------------------------
gulp.task 'browser-sync', ->
browserSync.init null,
open: false
baseDir: "./dist"
debounceDelay: 1000
gulp.task 'style', ->
gulp.src(sources.sass) # we defined that at the top of the file
.pipe(sass({outputStyle: 'compressed', errLogToConsole: true}))
gulp.task 'html', ->
# I put linting as a separate task so we can run it by itself if we want to
gulp.task 'lint', ->
gulp.task 'src', ->
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(if isProd then uglify() else gutil.noop())
gulp.task 'watch', -> sources.sass, ['style'], ['lint', 'src', 'html'] sources.html, ['html'], ['src'] 'dist/**/**', (file) ->
browserSync.reload(file.path) if file.type is "changed"
gulp.task 'clean', ->
gulp.src(['dist/'], {read: false}).pipe(clean())
gulp.task 'build', ->
runSequence 'clean', ['style', 'lint', 'src', 'html']
gulp.task 'default', [