-
Notifications
You must be signed in to change notification settings - Fork 14
/
gulpfile.js
127 lines (114 loc) · 2.88 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
var gulp = require('gulp')
var gutil = require('gulp-util')
var coffee = require('gulp-coffee')
var include = require('gulp-include')
var rename = require('gulp-rename')
var uglify = require('gulp-uglify')
var debug = require('gulp-debug')
var less = require("gulp-less")
var chug = require('gulp-chug')
var paths = {
html: ['src/**/*.html'],
less: ['src/less/*.less'],
select2: [
'external/select2-3.4.5/*.js',
'external/select2-3.4.5/*.css',
'external/select2-3.4.5/*.gif',
'external/select2-3.4.5/*.png',
],
ngTagsInput: [
'external/ng-tags-input/*.js',
'external/ng-tags-input/*.css',
],
fonts: [
'external/bootstrap/dist/fonts/*'
],
images: [
'src/img/*'
]
}
gulp.task('select2', function() {
gulp.src(paths.select2)
.pipe(rename(function(path) {
}))
.pipe(gulp.dest("static/select2"))
})
gulp.task('ngTagsInput', function() {
gulp.src(paths.ngTagsInput)
.pipe(rename(function(path) {
}))
.pipe(gulp.dest("static/ng-tags-input"))
})
gulp.task('fonts', function() {
gulp.src(paths.fonts)
.pipe(rename(function(path) {
}))
.pipe(gulp.dest("static/fonts"))
})
gulp.task('images', function() {
gulp.src(paths.images)
.pipe(gulp.dest('static/img'))
})
/* Build the application files by including
* all literate coffeescript files, compiling
* them and then including all javascript */
gulp.task('application', function(){
gulp.src('src/js/app.litcoffee')
.pipe(include({
extensions: "litcoffee"
})).on('error', gutil.log)
.pipe(coffee()).on('error', gutil.log)
.pipe(include({
extensions: "js"
}))
.pipe(rename(function(path) {
path.basename = "vespa"
}))
.pipe(gulp.dest('static/js'))
})
/* Build all assets using include, output
* them both minified and not minified */
gulp.task("script_assets", function() {
gulp.src('external/assets.js')
.pipe(include({extensions: 'js'}))
.pipe(gulp.dest('static/js'))
.pipe(uglify({
outSourceMap: true,
}))
.pipe(rename(function(path){
path.extname = '.min.js'
}))
.pipe(gulp.dest('static/js'))
})
/* Copy HTML files to the static directory */
gulp.task('html', function(){
gulp.src(paths.html)
.pipe(gulp.dest('static'))
})
/* Copy external assets to the static directory */
gulp.task('assets', function(){
gulp.src(paths.assets)
.pipe(gulp.dest('static'))
})
/* Run the LESS preprocessor */
gulp.task('less', function() {
gulp.src('src/less/vespa.less')
.pipe(less()).on('error', gutil.log)
.pipe(gulp.dest('static/css'))
})
gulp.task('reloader', function() {
gulp.watch(paths.html, [ 'html' ])
gulp.watch(['external/**/*.js'], ['script_assets'])
gulp.watch(['src/**/*coffee'], [ 'application' ])
gulp.watch(paths.less, ['less'])
})
gulp.task('default', [
'application',
'less',
'script_assets',
'html',
'select2',
'ngTagsInput',
'images',
'fonts'
])