-
-
Save johnpeele/43bae3c2f02696abeba6 to your computer and use it in GitHub Desktop.
Serve Harp with Gulp and 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 harp = require('harp'); | |
/** | |
* Serve the Harp Site from the src directory | |
*/ | |
gulp.task('serve', function () { | |
harp.server(__dirname + '/src', { | |
port: 9000 | |
}, function () { | |
browserSync({ | |
proxy: "localhost:9000", | |
open: false, | |
/* Hide the notification. It gets annoying */ | |
notify: { | |
styles: ['opacity: 0', 'position: absolute'] | |
} | |
}); | |
/** | |
* Watch for scss changes, tell BrowserSync to refresh main.css | |
*/ | |
gulp.watch("src/**/*.scss", function () { | |
reload("main.css", {stream: true}); | |
}); | |
/** | |
* Watch for all other changes, reload the whole page | |
*/ | |
gulp.watch(["src/**/*.jade", "src/**/*.json"], function () { | |
reload(); | |
}); | |
}) | |
}); | |
/** | |
* 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