-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
51 lines (45 loc) · 984 Bytes
/
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
const gulp = require('gulp');
const del = require('del');
const fileinclude = require('gulp-file-include');
const rename = require('gulp-rename');
const replace = require('gulp-replace');
/**
* Cleaner the build's folder
*/
function clean() {
return del(['build/*']);
}
/**
* Template engine. Converts and delivers to build
*/
function substitution() {
return gulp
.src(['src/loader'], { allowEmpty: true })
.pipe(
fileinclude({
prefix: '@@',
basepath: '@file'
})
)
.pipe(rename({ suffix: '.js' }))
.pipe(replace('/* eslint-disable */', ''))
.pipe(gulp.dest('build'));
}
/**
* Copy pure assets to build
*/
function assets() {
return gulp.src(['src/*.{json,js}']).pipe(gulp.dest('build'));
}
/**
* Gulp's task asserts
*/
gulp.task('asserts', assets);
/**
* Gulp's task clean
*/
gulp.task('clean', clean);
/**
* Gulp's task build
*/
gulp.task('build', gulp.series(clean, gulp.parallel(substitution, assets)));