-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
145 lines (122 loc) · 2.67 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
// gulp task dependencies
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var less = require('gulp-less');
var minifyCSS = require('gulp-minify-css');
var livereload = require('gulp-livereload');
var path = require('path');
//
// BASE PREFIX
//
var input = 'build/';
var output = 'dist/';
//
// DIST PATHS
//
var dist = {
outfile: 'apptPicker.min.js',
files: [
input + 'js/timeUtils.js',
input + 'js/jDom.js',
input + 'js/jDom.interpret.js',
input + 'js/apptPicker.js'
]
};
//
// DIST TASK
//
gulp.task('scripts:dist', function() {
return gulp.src(dist.files)
.pipe(uglify())
.pipe(concat(dist.outfile))
.pipe(gulp.dest(output + 'js/'))
.pipe(livereload());
});
//
// Demo JS Paths
//
var demojs = {
outfile: 'demo.min.js',
files: [
input + 'js/timeUtils.js',
input + 'js/jDom.js',
input + 'js/jDom.interpret.js',
input + 'js/apptPicker.js',
input + 'js/rainbow-custom.min.js',
input + 'js/apptPickerExample.js'
]
};
//
// Demo JS TASK
//
gulp.task('scripts:demo', function(){
return gulp.src(demojs.files)
.pipe(uglify())
.pipe(concat(demojs.outfile))
.pipe(gulp.dest(output + 'js/'))
.pipe(livereload());
});
//
// LESS PATHS
//
var css = {
files: [input + 'less/**/*.less'],
prefix: input + 'less',
outfile: 'style.min.css'
};
//
// STYLESHEET TASK
//
gulp.task('stylesheet:dist', function () {
return gulp.src(css.prefix + '/style.less')
.pipe(less())
.pipe(minifyCSS())
.pipe(concat(css.outfile))
.pipe(gulp.dest(output + 'css/'))
.pipe(livereload());
});
//
// LESS PATHS
//
var demo = {
files: [input + 'less/**/*.less'],
prefix: input + 'less',
outfile: 'demo.min.css'
};
//
// STYLESHEET TASK
//
gulp.task('stylesheet:demo', function () {
return gulp.src(demo.prefix + '/demo.less')
.pipe(less())
.pipe(minifyCSS())
.pipe(concat(demo.outfile))
.pipe(gulp.dest(output + 'css/'))
.pipe(livereload());
});
//
// HTML Task
//
gulp.task('html', function(){
return gulp.src('*.html')
.pipe(gulp.dest(''))
.pipe(livereload())
.pipe(notify({message: 'html task complete'}));
});
//
// WATCHER TASK
//
gulp.task('watch', function() {
gulp.watch(dist.files, ['scripts:dist']);
gulp.watch(demojs.files, ['scripts:demo']);
gulp.watch(css.files, ['stylesheet:dist']);
gulp.watch(css.files, ['stylesheet:demo']);
gulp.watch('*.html', ['html']);
});
//
// TASK ALIAS'
//
gulp.task('js', ['scripts:dist', 'scripts:demo']);
gulp.task('less', ['stylesheet:dist', 'stylesheet:demo']);
gulp.task('uber', ['scripts:dist', 'scripts:demo', 'stylesheet:dist', 'stylesheet:demo', 'watch']);