-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
47 lines (37 loc) · 2.49 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
var fs = require('fs');
var yargs = require('yargs');
var yaml = require('js-yaml');
var sequence = require('run-sequence');
var gulp = require('gulp');
var browserSync = require('browser-sync');
var requireDir = require('require-dir');
requireDir('./gulp-tasks');
// ALL THE CRAP BELLOW IS RUN WHEN YOU RUN `$ gulp` OR `$ gulp --production`
var PRODUCTION = !!(yargs.argv.production); // Run things that say 'PRODCUTION' on production builds only ($ gulp --production)
function loadConfig() {
var ymlFile = fs.readFileSync('gulpconfig.yml', 'utf8');
return yaml.load(ymlFile);
}
var config = loadConfig();
module.exports = config;
gulp.task('build', function(done) { // This runs the following tasks (above): clean (cleans _site/), jekyll-build (jekyll does its thing), SASS and JS tasks (compile them), copy (copies static assets like images to the site build)
sequence( 'clean', 'jekyll-build', 'sitemap', ['sass', 'contentSass', 'javascript', 'playlistScript'], 'copy', 'copyrss', done);
});
gulp.task('travisBuild', function(done) { // This runs the following tasks (above): clean (cleans _site/), jekyll-build (jekyll does its thing), SASS and JS tasks (compile them), copy (copies static assets like images to the site build)
sequence( 'clean', 'travisJekyllBuild', 'travisSitemap', ['travisSass', 'travisContentSass', 'travisScript', 'travisPlaylistScript'], 'travisCopy', 'travisCopyRss', done);
});
gulp.task('default', function(done) { // Default gulp task (run via 'gulp' in terminal)
sequence('build', 'browser-sync', 'watch', done); // Runs these things which in turn run other things.
});
gulp.task('watch', function() { // Watch for changes to be piped into browserSync on saving of files:
gulp.watch(config.watch.pages, ['build', browserSync.reload]); // Watch for new pages and changes.
gulp.watch(config.watch.javascript, ['javascript', browserSync.reload]); // JS changes
gulp.watch(config.watch.playlistScript, ['playlistScript', browserSync.reload]); // JS changes
gulp.watch(config.watch.sass, ['sass']); // SASS/SCSS changes
gulp.watch(config.watch.sass, ['contentSass']); // SASS/SCSS changes
gulp.watch(config.watch.images, ['copy', browserSync.reload]); // Watch for new static assets like images
gulp.watch(config.watch.copyrss, ['copyrss', browserSync.reload]); // Watch for new static assets like images
});
gulp.task('travis', function(done) { // Default gulp task (run via 'gulp' in terminal)
sequence('travisBuild', done); // Runs these things which in turn run other things.
});