-
Notifications
You must be signed in to change notification settings - Fork 38
/
gulpfile.js
43 lines (35 loc) · 989 Bytes
/
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
var gulp = require('gulp'),
watch = require('gulp-watch'),
gp_concat = require('gulp-concat'),
gp_rename = require('gulp-rename'),
gp_uglify = require('gulp-uglify');
var moduleSrc = [
'./src/core.js',
'./src/includes/module.inc.js',
'./src/includes/rest.inc.js',
'./src/includes/views.inc.js',
'./src/includes/views.inc.js',
'./src/entity.js',
'./src/comment.js',
'./src/file.js',
'./src/node.js',
'./src/taxonomy_term.js',
'./src/taxonomy_vocabulary.js',
'./src/user.js'
];
// Minify JavaScript
function minifyJs() {
console.log('compressing jdrupal.js...');
var moduleJs = gulp.src(moduleSrc)
.pipe(gp_concat('jdrupal.js'))
.pipe(gulp.dest('./'));
console.log('compressing jdrupal.min.js...');
return moduleJs.pipe(gp_rename('jdrupal.min.js'))
.pipe(gp_uglify())
.pipe(gulp.dest('./'));
}
gulp.task(minifyJs);
gulp.task('default', function(done) {
gulp.watch(moduleSrc, gulp.series('minifyJs'));
done();
});