forked from lucaslim/angular-masonry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
72 lines (61 loc) · 1.9 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
(function () {
'use strict';
var
gulp = require('gulp'),
bs = require('browser-sync').create(),
rs = require('run-sequence'),
ngAnnotate = require('gulp-ng-annotate'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
jshint = require('gulp-jshint');
/*
*
* Development
*
*/
gulp.task('server:dev', function () {
bs.init({
server: './dev/',
browser: 'google chrome'
});
});
gulp.task('jshint', function () {
return gulp.src('./app/**/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('js:dev', ['jshint'], function () {
return gulp.src('./app/angular-masonry.js')
.pipe(gulp.dest('./dev/'));
});
gulp.task('html:dev', function () {
return gulp.src('./app/index.html')
.pipe(gulp.dest('./dev/'));
});
gulp.task('watch', function () {
gulp.watch('./app/**/*.js', ['js:dev', bs.reload]);
gulp.watch('./app/index.html', ['html:dev']).on('change', bs.reload);
});
/*
*
* Build
*
*/
gulp.task('js:build:min', ['jshint'], function () {
return gulp.src('./app/angular-masonry.js')
.pipe(ngAnnotate({single_node: true}))
.pipe(uglify({compress: true, mangle: true}))
.pipe(concat('angular-masonry.min.js'))
.pipe(gulp.dest('./'));
});
gulp.task('js:build', ['jshint'], function () {
return gulp.src('./app/angular-masonry.js')
.pipe(ngAnnotate({single_node: true}))
.pipe(concat('angular-masonry.js'))
.pipe(gulp.dest('./'));
});
gulp.task('serve', function () {
rs('js:dev', 'html:dev', ['watch', 'server:dev']);
});
gulp.task('build', ['js:build', 'js:build:min']);
}());