Skip to content

Commit 88de294

Browse files
committed
Add Browsersync
1 parent 0704af3 commit 88de294

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

gulpfile.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var gulp = require('gulp');
2+
var browserSync = require('browser-sync').create();
23
$ = require('gulp-load-plugins')();
34

45
gulp.task('clean', function () {
@@ -11,7 +12,7 @@ gulp.task('copy', ['clean'], function () {
1112
.pipe(gulp.dest('dist/.'));
1213
});
1314

14-
gulp.task('usemin', ['copy'], function () {
15+
gulp.task('dist', ['copy'], function () {
1516
return gulp.src('app/index.html')
1617
.pipe($.usemin({
1718
css: [$.cleanCss(), $.rev()],
@@ -20,5 +21,15 @@ gulp.task('usemin', ['copy'], function () {
2021
.pipe(gulp.dest('dist/'));
2122
});
2223

24+
gulp.task('serve', function() {
25+
26+
browserSync.init({
27+
server: './app'
28+
});
29+
30+
gulp.watch(['app/**/*.js', 'app/**/*.css', 'app/**/*.html'])
31+
.on('change', browserSync.reload);
32+
});
33+
2334
// Tell Gulp what to do when we type "gulp" into the terminal
24-
gulp.task('default', ['usemin']);
35+
gulp.task('default', ['serve']);

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"license": "MIT",
88
"devDependencies": {
99
"bower": "^1.7.7",
10+
"browser-sync": "~2.15.0",
1011
"gulp": "~3.9.1",
1112
"gulp-clean": "~0.3.2",
1213
"gulp-concat": "~2.6.0",

0 commit comments

Comments
 (0)