Last active
August 29, 2015 14:26
-
-
Save LoganBarnett/25d619bea5a4aef85a3f to your computer and use it in GitHub Desktop.
Gulpfile for hosting some standard static assets
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
'use strict'; | |
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var browserSync = require('browser-sync').create(); | |
var reload = browserSync.reload; | |
var DIST = 'dist'; | |
gulp.task('default', ['dist']); | |
gulp.task('js', function() { | |
return gulp.src('src/**/*.js') | |
.pipe(gulp.dest(DIST)) | |
.pipe(reload({stream: true})) | |
; | |
}); | |
gulp.task('dist', ['js', 'copy-static']); | |
gulp.task('browsersync', ['dist'], function() { | |
browserSync.init(null, { | |
, files: ['src/**/*'] | |
, reloadOnRestart: true | |
, open: false | |
, port: 9000 | |
, server: { | |
baseDir: 'dist' | |
} | |
}); | |
gulp.watch('src/**/*.js', ['js']); | |
gulp.watch('src/index.html', ['copy-static']); | |
}); | |
gulp.task('copy-static', function() { | |
return gulp.src([ | |
'src/index.html' | |
]) | |
.pipe(gulp.dest(DIST)) | |
.pipe(reload({stream: true})) | |
; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment