-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathgulpfile.js
65 lines (55 loc) · 1.47 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
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
minifyCSS = require('gulp-minify-css');
/**
* Front end files.
* NOTE: this could be less explicit. ex: `public/css/*.css`
*/
var frontend = {
cssFiles: [
'./public/css/normalise.css',
'./public/css/forum.css'
],
jsFiles: [
'./public/src/lib/async.js',
'./public/src/lib/moment.js',
'./public/src/lib/jquery-2.0.3.min.js',
'./public/src/lib/underscore-min.js',
'./public/js/autolinker.js',
'./public/js/pasteImageReader.js',
'./public/js/thread.js',
'./public/js/global.js',
'./public/js/messages.js',
'./public/js/embeds.js'
]
};
/**
* Take all frontend.jsFiles , Uglify > concat > and save into main.min.js
*/
gulp.task('frontend:js', function() {
gulp.src(frontend.jsFiles)
.pipe(uglify())
.pipe(concat('main.min.js'))
.pipe(gulp.dest('./public/js'));
});
/**
* Take all frontend.cssFiles, minify > concat > and save into main.min.css
*/
gulp.task('frontend:css', function() {
gulp.src(frontend.cssFiles)
.pipe(minifyCSS())
.pipe(concat('main.min.css'))
.pipe(gulp.dest('./public/css'));
});
/**
* Watch files for changes and run task if files change
*/
gulp.task('watch', function() {
gulp.watch(frontend.jsFiles, ['frontend:js']);
gulp.watch(frontend.cssFiles, ['frontend:css']);
});
/**
* Run the default task
*/
gulp.task('default', ['watch', 'frontend:js', 'frontend:css']);