forked from yearbook/extendscript-api-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
74 lines (60 loc) · 1.66 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
var execSync = require('child_process').execSync;
var path = require('path');
var gulp = require('gulp');
var jade = require('gulp-jade');
var less = require('gulp-less');
var babel = require('gulp-babel');
var plumber = require('gulp-plumber');
var autoprefixer = require('gulp-autoprefixer');
var del = require('del');
gulp.task('templates', ['javascript', 'less'], function() {
return gulp.src(['src/templates/**/*.jade', '!src/templates/layout.jade'])
.pipe(jade({
locals: {}
}))
.pipe(gulp.dest('public/'));
});
gulp.task('less', function () {
return gulp.src('src/less/style.less')
.pipe(less({
paths: [
path.join(__dirname, 'vendor'),
]
}))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false,
}))
.pipe(gulp.dest('public/css'));
});
gulp.task('javascript', function() {
return gulp.src('src/javascript/**/*.js')
.pipe(babel())
.pipe(gulp.dest('public/js'));
});
gulp.task('static', function() {
return gulp.src('src/static/**/*')
.pipe(gulp.dest('public'));
});
gulp.task('web', ['javascript', 'less', 'templates', 'static']);
gulp.task('xml', function(cb) {
execSync('./src/findxml')
execSync('./src/xml2json.py')
execSync('./src/json2public.py')
cb();
});
gulp.task('clean', function() {
return del([
'public/**',
'xml/source/**',
'xml/json/**',
]);
});
gulp.task('build', ['xml', 'web']);
gulp.task('watch', ['web'], function () {
gulp.watch('src/templates/**/*', ['web']);
gulp.watch('src/less/**/*', ['web']);
gulp.watch('src/javascript/**/*', ['web']);
gulp.watch('src/static/**/*', ['web']);
});
gulp.task('default', ['build']);