forked from jagonteam/complete-me
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (55 loc) · 1.27 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
var gulp = require('gulp'),
prettify = require('gulp-jsbeautifier'),
runSequence = require('run-sequence'),
gutil = require('gulp-util'),
babel = require('gulp-babel');
var paths = {
scripts: [
'assets/js/*.js',
'server.js',
'controllers/*.js',
'utils/*.js'
]
}
gulp.task('verify-js', function() {
gulp.src(['assets/js/*.js'])
.pipe(prettify({
config: '.jsbeautifyrc',
mode: 'VERIFY_ONLY'
}));
});
gulp.task('prettify-js', function() {
gulp.src(paths.scripts)
.pipe(prettify({
config: '.jsbeautifyrc',
mode: 'VERIFY_AND_WRITE'
}))
.pipe(gulp.dest(function(file) {
return file.base;
}));
});
gulp.task('prettify-html', function() {
gulp.src(['assets/**/*.html'])
.pipe(prettify({
braceStyle: "collapse",
indentChar: " ",
indentSize: 4
}))
.pipe(gulp.dest('assets/'));
});
gulp.task('prettify-code', function() {
runSequence(
['prettify-js', 'prettify-html']
);
});
gulp.task('transpilation', function() {
gulp.src(['controllers/*.js'])
.pipe(babel({highlightCode: false}))
.pipe(gulp.dest('build'))
.on('error', gutil.log);
});
gulp.task('default', function() {
runSequence(
['prettify-code', 'transpilation']
);
});