Skip to content

Commit ae1dcaa

Browse files
author
Philipp Alferov
committed
Add browser-sync
1 parent a19b8e5 commit ae1dcaa

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

gulpfile.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var watchify = require('watchify');
77
var buffer = require('vinyl-buffer');
88
var source = require('vinyl-source-stream');
99
var sequence = require('run-sequence');
10+
var browserSync = require('browser-sync');
1011

1112
var config = {
1213
fileSaver: {
@@ -85,7 +86,8 @@ function buildScript() {
8586
.pipe($.size({
8687
title: 'Scripts: '
8788
}))
88-
.pipe(gulp.dest(browserifyDefaults.dest));
89+
.pipe(gulp.dest(browserifyDefaults.dest))
90+
.pipe($.if(browserSync.active, browserSync.stream()));
8991
}
9092

9193
return rebundle();
@@ -101,8 +103,21 @@ gulp.task('styles:docs', function() {
101103
config.docs.styles
102104
])
103105
.pipe($.concat('examples.css'))
104-
.pipe(gulp.dest(config.docs.dest));
105-
// .pipe($.if(browserSync.active, browserSync.stream()));
106+
.pipe(gulp.dest(config.docs.dest))
107+
.pipe($.if(browserSync.active, browserSync.stream()));
108+
});
109+
110+
gulp.task('serve', function () {
111+
112+
browserSync({
113+
port: config.browserSync.port,
114+
server: {
115+
baseDir: config.browserSync.server,
116+
},
117+
logConnections: true,
118+
logFileChanges: true,
119+
notify: true
120+
});
106121
});
107122

108123
gulp.task('deploy', function() {
@@ -126,7 +141,6 @@ gulp.task('build:docs', function() {
126141

127142
gulp.task('watch:docs', ['serve'], function() {
128143
gulp.watch(config.docs.styles, ['styles:docs']);
129-
gulp.watch(config.docs.templates, ['templates:docs']);
130144
});
131145

132146
gulp.task('default', ['build']);

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"homepage": "https://github.com/alferov/angular-file-saver",
2626
"devDependencies": {
2727
"browser-filesaver": "^1.0.0",
28+
"browser-sync": "^2.8.2",
2829
"browserify": "^11.0.1",
2930
"gulp": "^3.9.0",
3031
"gulp-concat": "^2.6.0",

0 commit comments

Comments
 (0)