-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
43 lines (37 loc) · 1.11 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var browserSync = require('browser-sync').create();
var webpackConfig = require('./webpack.config');
var webpack = require('webpack-stream');
var ngAnnotate = require('gulp-ng-annotate');
var server = {
baseDir: ['examples', './']
};
// Static server
gulp.task('browser-sync', function() {
var files = [
'dist/**/*',
'examples/**/*'
];
browserSync.init(files, {
server: server
});
});
gulp.task('webpack', function () {
return gulp.src('src/js/ui-tabs-view.js')
.pipe(webpack(webpackConfig, require('webpack')))
.pipe(rename('ui-tabs.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('watch', function () {
gulp.watch('src/**/*', ['webpack']);
});
gulp.task('pack', ['webpack'], function () {
return gulp.src('dist/ui-tabs.js')
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest('dist'));
});
gulp.task('default',['webpack', 'browser-sync', 'watch']); //定义默认任务