-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.mjs
77 lines (67 loc) · 2.55 KB
/
gulpfile.mjs
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// const sass = require('gulp-sass')(require('sass'));
import gulp from 'gulp';
import sourcemaps from 'gulp-sourcemaps';
import prefix from 'gulp-autoprefixer';
import gulpSass from 'gulp-sass';
import dartSass from 'sass';
const sass = gulpSass(dartSass);
/* ----------------------------------------- */
/* Compile Sass
/* ----------------------------------------- */
// Small error handler helper function.
function handleError(err) {
console.log(err.toString());
this.emit('end');
}
const SYSTEM_SCSS = ['scss/**/*.scss'];
function compileScss() {
// Configure options for sass output. For example, 'expanded' or 'nested'
let options = {
outputStyle: 'expanded',
};
return gulp
.src(SYSTEM_SCSS)
.pipe(sourcemaps.init())
.pipe(sass(options).on('error', handleError))
.pipe(
prefix({
cascade: false,
})
)
.pipe(sourcemaps.write())
.pipe(gulp.dest('./css'));
}
const css = gulp.series(compileScss);
async function packAll() {
const fvtt = await import('@foundryvtt/foundryvtt-cli');
// Compile LevelDB compendium packs.
await fvtt.compilePack('packs/src/abilities', 'packs/abilities');
await fvtt.compilePack('packs/src/specialties', 'packs/specialties');
await fvtt.compilePack('packs/src/roles', 'packs/roles');
await fvtt.compilePack('packs/src/gear', 'packs/gear');
await fvtt.compilePack('packs/src/manual', 'packs/manual');
await fvtt.compilePack('packs/src/illumination-keys', 'packs/illumination-keys');
}
async function unpackAll() {
const fvtt = await import('@foundryvtt/foundryvtt-cli');
// Decompile LevelDB compendium packs.
await fvtt.extractPack('packs/abilities', 'packs/src/abilities');
await fvtt.extractPack('packs/specialties', 'packs/src/specialties');
await fvtt.extractPack('packs/roles', 'packs/src/roles');
await fvtt.extractPack('packs/gear', 'packs/src/gear');
await fvtt.extractPack('packs/manual', 'packs/src/manual');
await fvtt.extractPack('packs/illumination-keys', 'packs/src/illumination-keys');
}
/* ----------------------------------------- */
/* Watch Updates
/* ----------------------------------------- */
function watchUpdates() {
gulp.watch(SYSTEM_SCSS, css);
}
/* ----------------------------------------- */
/* Export Tasks
/* ----------------------------------------- */
gulp.task('build', gulp.series(compileScss))
gulp.task('pack', gulp.series(packAll))
gulp.task('unpack', gulp.series(unpackAll))
gulp.task('default', gulp.series(compileScss, watchUpdates))