-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
169 lines (142 loc) · 3.85 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
'use strict';
var gulp = require('gulp'),
concat = require('gulp-concat'),
scss = require('gulp-sass'),
uglify = require('gulp-uglify'),
ngAnnotate = require('gulp-ng-annotate'),
webserver = require('gulp-webserver');
gulp.task('js', function(){
gulp.src([
'bower_components/jquery/dist/jquery.js',
'bower_components/jquery-jsone/jquery.json.min.js',
'bower_components/bootstrap/dist/js/bootstrap.js',
'bower_components/angular/angular.js',
'bower_components/ui-masks/mask.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-touch/angular-touch.js',
'bower_components/angular-bootstrap/ui-bootstrap.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.js'
])
.pipe(ngAnnotate())
.pipe(concat('libs.js'))
.pipe(gulp.dest('build/dev'));
gulp.src([
'build/dev/app/*.js',
'build/dev/app/**/*.js',
'!build/dev/app/**/*_test.js',
])
.pipe(concat('app.js'))
.pipe(gulp.dest('build/dev'));
});
gulp.task('app', function(){
gulp.src([
'build/dev/app/*.js',
'build/dev/app/**/*.js',
'!build/dev/app/**/*_test.js',
])
.pipe(concat('app.js'))
.pipe(gulp.dest('build/dev'));
});
gulp.task('css',function(){
gulp.src([
'bower_components/bootstrap/dist/css/bootstrap.css',
'bower_components/bootstrap/dist/css/bootstrap-theme.css',
'bower_components/angular-bootstrap/ui-bootstrap-csp.css',
'bower_components/angular/angular-csp.css'
])
.pipe(concat('theme.css'))
.pipe(gulp.dest('build/dev'));
gulp.src('build/dev/app/**/*.scss')
.pipe(scss())
.pipe(concat('app.css'))
//autoprefix
//minification
.pipe(gulp.dest('build/dev'));
});
gulp.task('webserver', function(){
gulp.src('build/dev/')
.pipe(webserver({
livereload : true,
open : true
}));
});
gulp.task('watch',function(){
gulp.watch('build/dev/app/**/*.js', ['js']);
gulp.watch('build/dev/app/**/*.scss', ['css']);
//gulp.watch('build/dev/app/**/*.*', ['app']);
});
//================ productions tasks =====================
gulp.task('pjs', function(){
gulp.src([
'bower_components/angular/angular.min.js',
//'bower_components/angular-route/angular-route.js',
'bower_components/angular-ui-router/release/angular-ui-router.min.js',
'bower_components/angular-bootstrap/ui-bootstrap.min.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
'bower_components/firebase/firebase.js',
'bower_components/angularfire/dist/angularfire.js',
'bower_components/angular-ui-grid/ui-grid.js'
])
.pipe(ngAnnotate())
.pipe(concat('libs.js'))
.pipe(gulp.dest('build/prod'));
gulp.src([
'build/dev/app/*.js',
'build/dev/app/**/*.js',
'!build/dev/app/**/*_test.js',
])
.pipe(ngAnnotate())
.pipe(concat('app.js'))
.pipe(uglify())
.pipe(gulp.dest('build/prod'));
});
gulp.task('pcss',function(){
gulp.src([
'bower_components/bootstrap/dist/css/bootstrap.min.css',
'bower_components/bootstrap/dist/css/bootstrap-theme.min.css',
'bower_components/angular-bootstrap/ui-bootstrap-csp.min.css',
'bower_components/angular/angular-csp.min.css'
])
.pipe(concat('theme.css'))
//.pipe(minify())
.pipe(gulp.dest('build/prod'));
gulp.src('build/dev/app/**/*.scss')
.pipe(scss())
.pipe(concat('app.css'))
//autoprefix
//minification
.pipe(gulp.dest('build/prod'));
});
gulp.task('pwebserver', function(){
gulp.src('build/prod/')
.pipe(webserver({
livereload : true,
open : true
}));
});
gulp.task('html', function(){
gulp.src([
'build/dev/app/**/*.html',
'build/dev/*.html'
])
.pipe(gulp.dest('build/prod'));
})
gulp.task('pwatch',function(){
gulp.watch('build/prod/app/**/*.js', ['js']);
gulp.watch('build/prod/app/**/*.scss', ['css']);
gulp.watch('build/prod/app/**/*.html', ['phtml']);
})
gulp.task('default', [
'js',
'css',
//'app',
'watch',
'webserver'
]);
gulp.task('prod',[
'pjs',
'pcss',
'html',
'pwatch',
'pwebserver',
])