forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
50 lines (40 loc) · 1.59 KB
/
gulpfile.babel.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
const gulp = require('gulp')
const gulpPlugins = require('gulp-load-plugins')()
const DIST = 'public/dist'
const STUFF_TO_REV = [
'public/fonts/**/*',
'public/images/**/*',
// We javascript_include_tag('require.js') directly from rails
'public/javascripts/vendor/require.js',
'public/optimized/vendor/require.js',
// But for all other javascript, we only load stuff using js_bundle.
// Meaning that we only include stuff in the "bundles" dir from rails.
// In prod, the 'optimized' versions of these bundles will include all their deps
'public/javascripts/compiled/bundles/**/*',
'public/optimized/compiled/bundles/**/*',
'public/javascripts/plugins/*/compiled/bundles/**/*',
'public/optimized/plugins/*/compiled/bundles/**/*',
// Special Cases:
// These guys have links in their css to images from their own dir
'public/javascripts/vendor/slickgrid/**/*',
'public/javascripts/bower/jquery.smartbanner/**/*',
'public/javascripts/bower/tinymce/skins/lightgray/**/*',
// Include *everything* from plugins & client_apps
// so we don't have to worry about their internals
'public/plugins/**/*',
'public/javascripts/client_apps**/*'
]
gulp.task('rev', () => {
gulp.src(STUFF_TO_REV, {
base: 'public', // tell it to use the 'public' folder as the base of all paths
follow: true // follow symlinks, so it picks up on images inside plugins and stuff
})
.pipe(gulpPlugins.rev())
.pipe(gulp.dest(DIST))
.pipe(gulpPlugins.rev.manifest())
.pipe(gulp.dest(DIST))
})
gulp.task('watch', () => {
gulp.watch(STUFF_TO_REV, ['rev'])
})
gulp.task('default', ['rev', 'watch'])