-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
49 lines (42 loc) · 1.35 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
const fs = require('fs');
const gulp = require('gulp');
const sass = require('gulp-sass');
const tsPipeline = require('gulp-webpack-typescript-pipeline');
const path = require('path');
tsPipeline.registerBuildGulpTasks(
gulp,
{
entryPoints: {
nuclear: path.join(__dirname, 'src/game/main.ts')
},
outputDir: path.join(__dirname, 'src/public/js')
}
);
// Move all images from assets into the public folder
gulp.task('assets:images', () => {
gulp.src(['./src/assets/**/*.png'])
.pipe(gulp.dest('./src/public/images'));
});
// Move all JS assets from node_modules into the JS folder
gulp.task('assets:js', () => {
gulp.src(['./node_modules/paper/dist/paper-full.js'])
.pipe(gulp.dest('./src/public/js'));
});
// Compile Sass
gulp.task('sass', () => {
return gulp.src('./src/scss/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./src/public/css'));
});
// Listen for file changes to compile Sass
gulp.task('sass:watch', () => {
gulp.watch('./src/scss/**/*.scss', ['sass']);
});
// Compile Typescript
gulp.task('ts', ['tsPipeline:build:dev']);
gulp.task('ts:prod', ['tsPipeline:build:release']);
gulp.task('ts:watch', ['tsPipeline:watch']);
gulp.task('assets', ['assets:images', 'assets:js']);
gulp.task('dev', ['assets', 'sass', 'sass:watch', 'ts:watch']);
gulp.task('prod', ['assets', 'sass', 'ts:prod']);
gulp.task('default', ['dev']);