-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gulpfile.js
69 lines (57 loc) · 2.16 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
'use strict';
var gulp = require('gulp');
var less = require('gulp-less');
var concat = require('gulp-concat');
var uglyfly = require('gulp-uglyfly');
var gulpif = require('gulp-if');
var replace = require('gulp-replace');
var devMode = false;
var config = {
jsSrcDir : './public/assets/src2/js/',
jsDistDir : './public/assets/v2/js/',
cssSrcDir : './public/assets/src2/less/',
cssDistDir : './public/assets/v2/css/'
};
gulp.task('default', ['style:less', 'scripts:build'], function () {});
gulp.task('style:less', function () {
gulp.src(config.cssSrcDir + 'style.less')
.pipe(less({'compress' : !devMode}))
.pipe(concat('app.min.css'))
.pipe(gulp.dest(config.cssSrcDir));
return gulp.src([
config.cssSrcDir + 'bootstrap.min.css',
config.cssSrcDir + 'bootstrap-responsive.min.css',
config.cssSrcDir + 'app.min.css'
])
.pipe(concat('core.min.css'))
.pipe(gulp.dest(config.cssDistDir));
});
gulp.task('scripts:build', function () {
var curDate = new Date();
var sign = ['/*! Build Date:', curDate.toTimeString(), curDate.toDateString(), 'Project Name:', 'go9999.js', '*/'].join(' ');
gulp.src([
config.jsSrcDir + 'lib/jquery-1.11.3.min.js',
config.jsSrcDir + 'lib/bootstrap.min.js',
config.jsSrcDir + 'lib/jquery.smooth-scroll.min.js',
config.jsSrcDir + 'lib/jquery.city.select.min.js',
config.jsSrcDir + 'lib/jquery.validate.min.js',
config.jsSrcDir + 'lib/jquery.form.min.js'
])
.pipe(concat('core.min.js'))
.pipe(gulpif(!devMode, replace(/^!f/, sign + '\n!f')))
.pipe(gulp.dest(config.jsDistDir));
gulp.src([
config.jsSrcDir + 'page/index.js',
config.jsSrcDir + 'page/join.js',
config.jsSrcDir + 'page/school.js',
config.jsSrcDir + 'page/map.js',
])
.pipe(concat('app.min.js'))
.pipe(gulpif(!devMode, uglyfly()))
.pipe(gulpif(!devMode, replace(/^!f/, sign + '\n!f')))
.pipe(gulp.dest(config.jsDistDir));
return gulp.src([
config.jsSrcDir + 'lib/html5.js',
config.jsSrcDir + 'lib/respond.js'
]).pipe(gulp.dest(config.jsDistDir));
});