Skip to content

Instantly share code, notes, and snippets.

@mistergraphx
Created March 6, 2016 16:34
Show Gist options
  • Save mistergraphx/f1297761f1c6907a14a3 to your computer and use it in GitHub Desktop.
Save mistergraphx/f1297761f1c6907a14a3 to your computer and use it in GitHub Desktop.
function browserSyncInit(baseDir, files) {
browserSync.instance = browserSync.init(files, {
startPath: '/', server: { baseDir: baseDir }
});
}
// starts a development server
// runs preprocessor tasks before,
// and serves the src and .tmp folders
gulp.task(
'serve',
['typescript', 'jade', 'sass', 'inject' ],
function () {
browserSyncInit([
paths.tmp
paths.src
], [
paths.tmp + '/**/*.css',
paths.tmp + '/**/*.js',
paths.tmp + '/**/*.html'
]);
});
// starts a production server
// runs the build task before,
// and serves the dist folder
gulp.task('serve:dist', ['build'], function () {
browserSyncInit(paths.dist);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment