Skip to content

Instantly share code, notes, and snippets.

@nakajmg
Last active August 29, 2015 14:05
Show Gist options
  • Save nakajmg/842b80bd1f1eab7c491f to your computer and use it in GitHub Desktop.
Save nakajmg/842b80bd1f1eab7c491f to your computer and use it in GitHub Desktop.
(●^o^●)
var gulp = require('gulp');
var browserSync = require('browser-sync');
var concat = require('gulp-concat');
var reload = browserSync.reload
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir : './src'
},
notify: false,
host: 'localhost'
});
});
// HTML保存時
gulp.task('html', function() {
return gulp.src('./src/**/*.html')
.pipe(gulp.dest('./dist/'))
});
// JS保存時
gulp.task('scripts', function() {
return gulp.src('./src/js/*.js')
.pipe(concat('all.js'))
.pipe(gulp.dest('./dist/js/'));
});
// 監視
gulp.task('watch', function () {
gulp.watch(['./src/**/*.html'], ['html', reload]);
gulp.watch(['./src/js/*.js'], ['scripts', reload]);
});
gulp.task('default', ['browser-sync', 'watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment