Last active
August 29, 2015 13:56
-
-
Save tbrd/9312976 to your computer and use it in GitHub Desktop.
Gulp hogan compile task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var gulp = require('gulp'); | |
var refresh = require('gulp-livereload'); | |
var livereload = require('tiny-lr'); | |
var server = livereload(); | |
var concat = require('gulp-concat'); | |
var hogan = require('gulp-hogan-compile'); | |
gulp.task('livereload-server', function () { | |
server.listen(35729, function (err) { | |
if (err) { return console.log(err); } | |
}); | |
}); | |
gulp.task('css', function () { | |
gulp.src('app/**/*.css').pipe(refresh(server)); | |
}); | |
gulp.task('js', function () { | |
gulp.src('app/**/*.js').pipe(refresh(server)); | |
}); | |
gulp.task('hogan', function () { | |
gulp.src('templates/**/*.hogan') | |
.pipe(hogan('templates.js', { | |
hoganModule: '.app/hogan' | |
})) | |
.pipe(gulp.dest('build')) | |
.pipe(refresh(server)); | |
}); | |
gulp.task('default', function () { | |
gulp.run('hogan'); | |
gulp.run('livereload-server'); | |
gulp.watch('app/**/*.css', function (event) { | |
gulp.run('css'); | |
}); | |
gulp.watch('app/**/*.js', function (event) { | |
gulp.run('js'); | |
}); | |
gulp.watch('templates/**/*.hogan', function (event) { | |
gulp.run('hogan'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment