Skip to content

Commit 1d897ab

Browse files
committed
refactor gulpfile
1 parent 0d0779c commit 1d897ab

File tree

3 files changed

+30
-44
lines changed

3 files changed

+30
-44
lines changed

app/components/message-list/message-list.directive.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
<li ng-repeat="message in vm.messages track by $index">
55
{{::message.text}}
66
</li>
7-
</ul>
7+
</ul>

app/templates.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
var gulp = require('gulp');
1+

2+
var gulp = require('gulp');
23
var templateCache = require('gulp-angular-templatecache');
34
var gutil = require('gulp-util');
45

@@ -11,55 +12,40 @@ webpackDevCfg.devtool = 'sourcemap';
1112
webpackDevCfg.debug = true;
1213
var devCompiler = webpack(webpackDevCfg);
1314

14-
gulp.task('tpl-cache', function () {
15-
return gulp.src('app/**/*html')
16-
.pipe(templateCache({
17-
standalone: true
18-
}))
19-
.pipe(gulp.dest('app'));
15+
gulp.task('tpl-cache', function() {
16+
return gulp.src('app/**/*html')
17+
.pipe(templateCache({
18+
standalone: true
19+
}))
20+
.pipe(gulp.dest('app'));
2021
});
2122

22-
gulp.task('watch:html', function () {
23-
return gulp.watch(['app/**/*.html'], ['tpl-cache']);
23+
gulp.task('watch:html', function() {
24+
return gulp.watch(['app/**/*.html'], ['tpl-cache']);
2425
});
2526

2627

27-
gulp.task('build-dev', ['tpl-cache', 'webpack:build-dev'], function () {
28-
gulp.watch(['app/**/*'], ['tpl-cache', 'webpack:build-dev']);
29-
});
30-
31-
gulp.task('webpack:dev-server', function (callback) {
28+
gulp.task('webpack:dev-server', function(callback) {
3229

33-
new WebpackDevServer(devCompiler, {
34-
contentBase: 'public',
35-
hot: true,
36-
filename: 'bundle.js',
37-
watchOptions: {
38-
aggregateTimeout: 300,
39-
poll: 1000
40-
}
41-
}).listen(8080, 'localhost', function (err) {
42-
if (err) throw new gutil.PluginError('webpack-dev-server', err);
30+
new WebpackDevServer(devCompiler, {
31+
contentBase: 'public',
32+
hot: true,
33+
filename: 'bundle.js',
34+
watchOptions: {
35+
aggregateTimeout: 300,
36+
poll: 1000
37+
}
38+
}).listen(8080, 'localhost', function(err) {
39+
if (err) throw new gutil.PluginError('webpack-dev-server', err);
4340

44-
gutil.log('[webpack-dev-server]', 'http://localhost:8080/webpack-dev-server/index.html');
41+
gutil.log('[webpack-dev-server]', 'http://localhost:8080/webpack-dev-server/index.html');
4542

46-
callback();
47-
});
43+
callback();
44+
});
4845
});
4946

50-
gulp.task('webpack:build-dev', function (callback) {
51-
devCompiler.run(function (err, stats) {
52-
if (err) throw new gutil.PluginError('webpack:build-dev', err);
53-
gutil.log('[webpack:build-dev]', stats.toString({
54-
colors: true
55-
}));
56-
callback();
57-
});
58-
});
59-
60-
61-
gulp.task('json-server', function () {
62-
require('./index');
47+
gulp.task('json-server', function() {
48+
require('./index');
6349
});
6450

65-
gulp.task('default', ['json-server', 'watch:html', 'webpack:dev-server']);
51+
gulp.task('default', ['json-server', 'watch:html', 'webpack:dev-server']);

0 commit comments

Comments
 (0)