-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
98 lines (88 loc) · 3.12 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
var gulp = require('gulp');
var gulpif = require('gulp-if');
var uglify = require('gulp-uglify');
var uglifycss = require('gulp-uglifycss');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var livereload = require('gulp-livereload');
var env = process.env.GULP_ENV;
var appRootPath = 'web/assets/app/';
var paths = {
app: {
js_head: [
'web/assets/vendor/modernizr/modernizr.js'
],
js: [
'web/assets/vendor/jquery/dist/jquery.min.js',
'web/assets/vendor/bootstrap/dist/js/bootstrap.min.js',
'web/assets/vendor/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js',
'web/assets/vendor/moment/min/moment.min.js',
'web/assets/public/js/custom-vendor/fullcalendar.js',
'web/assets/public/js/custom-vendor/locale-all.js',
'web/assets/public/js/script.js'
],
js_ie: [
'web/assets/vendor/html5shiv/dist/html5shiv.js',
'web/assets/vendor/respond/src/respond.js',
'web/assets/vendor/classie/classie.js',
],
css: [
'web/assets/vendor/bootstrap/dist/css/bootstrap.css',
'web/assets/vendor/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css',
'web/assets/public/css/custom-vendor/fullcalendar.min.css',
'web/assets/public/css/calendarwod.css',
'web/assets/public/css/main.css',
],
fonts: [
'web/assets/vendor/bootstrap/fonts/**'
]
}
};
gulp.task('app-js', function () {
return gulp.src(paths.app.js)
.pipe(concat('app.js'))
.pipe(gulpif(env === 'prod', uglify()))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(appRootPath + 'js/'))
;
});
gulp.task('app-js-head', function () {
return gulp.src(paths.app.js_head)
.pipe(concat('app_head.js'))
.pipe(gulpif(env === 'prod', uglify()))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(appRootPath + 'js/'))
;
});
gulp.task('app-js-ie', function () {
return gulp.src(paths.app.js_head)
.pipe(concat('app_ie.js'))
.pipe(gulpif(env === 'prod', uglify()))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(appRootPath + 'js/'))
;
});
gulp.task('app-css', function() {
return gulp.src(paths.app.css)
.pipe(concat('style.css'))
.pipe(gulpif(env === 'prod', uglifycss()))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(appRootPath + 'css/'))
;
});
gulp.task('app-fonts', function() {
return gulp.src(paths.app.fonts)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(appRootPath + 'fonts/'))
;
});
gulp.task('app-watch', function() {
livereload.listen();
gulp.watch(paths.app.js, ['app-js']);
gulp.watch(paths.app.js_head, ['app-js-head']);
gulp.watch(paths.app.js_ie, ['app-js-ie']);
gulp.watch(paths.app.css, ['app-css']);
gulp.watch(paths.app.fonts, ['app-fonts']);
});
gulp.task('default', ['app-js', 'app-js-head', 'app-js-ie', 'app-css', 'app-fonts']);
gulp.task('watch', ['default', 'app-watch']);