forked from readthedocs/readthedocs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (45 loc) · 1.36 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
var gulp = require('gulp'),
browserify = require('gulp-browserify'),
gulp_util = require('gulp-util'),
run = require('gulp-run'),
debowerify = require('debowerify');
/* Applications with static sources */
var sources = {
'readthedocs/core': [
'readthedocs/core/static-src/**/readthedocs-doc-embed.js'
],
'readthedocs/projects': [
'readthedocs/projects/static-src/**/tools.js'
],
'readthedocs/gold': [
'readthedocs/gold/static-src/**/gold.js'
],
'readthedocs/donate': [
'readthedocs/donate/static-src/**/donate.js'
]
};
/* Doc embed scripts */
gulp.task('browserify', function () {
for (application in sources) {
gulp.src(sources[application])
.pipe(browserify({
transform: ['debowerify']
}))
.on('error', function (event) {
gulp_util.log(event.message);
})
.pipe(gulp.dest(application + '/static/'));
}
});
gulp.task('collect', function () {
gulp_util.log('Collecting static files');
run('readthedocs/manage.py collectstatic --noinput')
.exec();
});
/* Tasks */
gulp.task('build', ['browserify', 'collect']);
gulp.task('dev', ['build', 'watch']);
gulp.task('watch', function () {
gulp.watch('readthedocs/**/static-src/**/*.js', ['build']);
});
gulp.task('default', ['build']);