Skip to content

Instantly share code, notes, and snippets.

@johnpeele
Forked from superhighfives/gulpfile.js
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnpeele/e8e6288bd8b6aee79f1b to your computer and use it in GitHub Desktop.
Save johnpeele/e8e6288bd8b6aee79f1b to your computer and use it in GitHub Desktop.
Gulp / Harp with BrowserSync
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var deploy = require('gulp-gh-pages');
var cp = require('child_process');
var harp = require('harp')
/**
* Serve the Harp Site
*/
gulp.task('serve', function (done) {
harp.server('.', {
port: 9000
}, function () {
browserSync({
proxy: "localhost:9000"
});
gulp.watch("public/**/*", function () {
reload({stream: true});
});
})
});
/**
* Build the Harp Site
*/
gulp.task('build', function (done) {
cp.exec('harp compile . dist', {stdio: 'inherit'})
.on('close', done)
});
/**
* Browser-sync task, only cares about compiled CSS
*/
gulp.task('browser-sync', function() {
browserSync({
proxy: "localhost:9000"
});
});
/**
* Push build to gh-pages
*/
gulp.task('deploy', ['build'], function () {
gulp.src("./dist/**/*")
.pipe(deploy());
});
/**
* Default task, running just `gulp` will compile the sass,
* compile the harp site, launch BrowserSync & watch files.
*/
gulp.task('default', ['serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment