-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
57 lines (51 loc) · 1.19 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 gulpSass = require('gulp-sass')(require('sass'));
const Fiber = require('fibers');
gulpSass.compiler = require('sass');
const del = require('del');
const ts = require('gulp-typescript');
const tsProject = ts.createProject('tsconfig.json');
// distの削除
function clean(cb) {
del.sync('./dist');
cb();
}
// ファイルコピー
function copy() {
return gulp.src([
'./src/**/*.*', '!src/sass/**/*.scss', '!src/ts/**/*.ts'
], {
base: './src'
})
.pipe(gulp.dest('./dist'));
}
// sassのコンパイル
function sass() {
return gulp.src('./src/sass/*.scss')
.pipe(
gulpSass({
fiber: Fiber,
outputStyle: 'compressed',
})
)
.pipe(gulp.dest('./dist/sass'))
}
// TypeScriptのトランスパイル
function script() {
return gulp.src('./src/ts/**/*.ts')
.pipe(tsProject())
.js.pipe(gulp.dest('./dist/js'));
}
const build = gulp.series (
clean,
gulp.parallel(
copy,
sass,
script,
),
);
exports.clean = clean;
exports.copy = copy;
exports.sass = sass;
exports.script = script;
exports.build = build;