-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
74 lines (58 loc) · 1.69 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const javascriptEntry = 'src/javascript/app.js';
const javascriptSrc = 'src/javascript/**/*.js';
const javascriptDest = 'javascript';
const eslint = require('gulp-eslint');
const sass = require('gulp-sass');
const sassSrc = 'src/sass/**/*.scss';
const sassDest = 'css';
const editorSassSrc = 'src/editor/**/*.scss';
const editorSassDest = 'css';
const gulp = require('gulp');
const webpack = require('webpack');
const webpackStream = require('webpack-stream');
const webpackConfig = require('./webpack.config.js');
// This function can be used to copy fonts to the webfonts dir
function copyFonts() {
// return gulp.src([
//
// ])
// .pipe(gulp.dest('webfonts'));
}
function buildJs() {
return gulp.src(javascriptEntry)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
.pipe(webpackStream(webpackConfig), webpack)
.pipe(gulp.dest(javascriptDest));
}
function watchJs() {
gulp.watch(javascriptSrc, buildJs);
}
function buildSass() {
return gulp.src(sassSrc)
.pipe(sass({
outputStyle: 'compressed',
}))
.on('error', sass.logError)
.pipe(gulp.dest(sassDest));
}
function buildEditorSass() {
return gulp.src(editorSassSrc)
.pipe(sass({
outputStyle: 'compressed',
}))
.on('error', sass.logError)
.pipe(gulp.dest(editorSassDest));
}
function watchSass() {
gulp.watch(sassSrc, buildSass);
gulp.watch(editorSassSrc, buildEditorSass);
}
exports.copyFonts = copyFonts;
exports.js = buildJs;
exports.watchjs = watchJs;
exports.sass = buildSass;
exports.watchSass = watchSass;
exports.buildEditorSass = buildEditorSass;
exports.default = gulp.parallel(copyFonts, buildJs, buildSass, buildEditorSass, watchJs, watchSass);