-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
54 lines (46 loc) · 1.2 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
/**
* Copyright (C) 2018 The Trustees of Indiana University
* SPDX-License-Identifier: BSD-3-Clause
*/
const { dest, series, src, watch } = require('gulp');
const browserSync = require('browser-sync').create();
const hugo = require('./tasks/hugo').hugo;
const js = require('./tasks/javascript');
const sass = require('./tasks/css').sass;
function watchFiles(callback) {
browserSync.init({
port: 3000,
server: {
baseDir: './public/'
},
files: ['public/**/*'],
open: false,
logLevel: 'silent',
notify: false
});
watch('assets/js/**/*.js', { ignoreInitial: false }, series(js.transpileJS, js.concatJS, hugoDev));
watch('assets/scss/**/*.scss', { ignoreInitial: false }, series(sass, hugoDev));
watch('content/**/*.md');
watch(
[
'layouts/**/*',
'content/**/*',
'archetypes/**/*',
'static/**/*',
'data/**/*'
],
hugoDev
);
callback();
}
function envProd(callback) {
process.env.NODE_ENV = 'production';
process.env.HUGO_ENV = 'production';
callback();
}
function hugoDev(callback) {
hugo(true);
callback();
}
exports.build = series(envProd, sass, js.transpileJS, js.concatJS);
exports.serve = series(hugoDev, watchFiles);