forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
57 lines (46 loc) · 1.81 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
const gulp = require('gulp')
const gulpPlugins = require('gulp-load-plugins')()
const DIST = 'public/dist'
const STUFF_TO_REV = [
'public/fonts/**/*',
'public/images/**/*',
// These are things we javascript_include_tag(...) directly from rails
'public/javascripts/vendor/require.js',
'public/optimized/vendor/require.js',
'public/javascripts/vendor/ie11-polyfill.js',
'public/javascripts/vendor/lato-fontfaceobserver.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 files have links in their css to images from their own dir
'public/javascripts/vendor/slickgrid/**/*',
'public/javascripts/symlink_to_node_modules/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', function(){
var stuffToRev = STUFF_TO_REV;
if(process.env.SKIP_JS_REV){
// just get fonts and images
stuffToRev = STUFF_TO_REV.slice(0,2)
}
gulp.src(stuffToRev, {
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', function(){
gulp.watch(STUFF_TO_REV, ['rev'])
})
gulp.task('default', ['rev', 'watch'])