This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
gulpfile.js
72 lines (60 loc) · 1.86 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
var gulp = require('gulp');
var concat = require('gulp-concat');
var runSequence = require('run-sequence');
var livereload = require('gulp-livereload');
var connect = require('gulp-connect');
var sass = require('gulp-sass');
var karmaServer = require('karma').Server;
var ngAnnotate = require('gulp-ng-annotate');
var uglify = require('gulp-uglify');
gulp.task('default', ['build']);
gulp.task('build', function() {
return runSequence('sass', 'concat', 'concat-uglify', 'connect', 'addwatch');
})
gulp.task('concat-uglify',function(){
return gulp.src(['src/js/directives/chips.js', 'src/js/**/*.js'])
.pipe(concat('angular-chips.min.js'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(gulp.dest('dist/'));
});
gulp.task('concat', function() {
return gulp.src(['src/js/directives/chips.js', 'src/js/**/*.js'])
.pipe(concat('angular-chips.js'))
.pipe(ngAnnotate())
.pipe(gulp.dest('dist/'))
.pipe(connect.reload());
});
gulp.task('sass', function() {
return gulp.src('src/css/main.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('dist/'))
.pipe(connect.reload());
});
gulp.task('refreshtml', function() {
gulp.src('samples/index.html')
.pipe(connect.reload());
});
gulp.task('addwatch', function() {
gulp.watch(['src/js/**/*.js', 'samples/*.js'], function() {
gulp.run('concat');
});
gulp.watch('samples/index.html', function() {
gulp.run('refreshtml')
});
gulp.watch('src/css/main.scss', function() {
gulp.run('sass');
});
});
gulp.task('connect', function() {
var server = connect.server({
livereload: true,
port: 9000,
});
});
gulp.task('test', ['sass', 'concat'], function(done) {
new karmaServer({
configFile: __dirname + '/karma.config.js',
singleRun: true
}, done).start();
});