-
-
Save johnpeele/e8e6288bd8b6aee79f1b to your computer and use it in GitHub Desktop.
Gulp / Harp with BrowserSync
This file contains hidden or 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
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