-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
29 lines (25 loc) · 971 Bytes
/
gulpfile.js
File metadata and controls
29 lines (25 loc) · 971 Bytes
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
const gulp = require('gulp');
const concat = require('gulp-concat');
const terser = require('gulp-terser');
const watch = require('gulp-watch');
const sass = require('gulp-sass')(require('sass'));
const cleanCSS = require('gulp-clean-css');
function scripts() {
return gulp.src('src/resources/*.js')
.pipe(concat('script.min.js'))
.pipe(terser())
.pipe(gulp.dest('src/resources/dist'));
}
function styles() {
return gulp.src('src/resources/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(concat('style.min.css'))
.pipe(cleanCSS())
.pipe(gulp.dest('src/resources/dist'));
}
function watchFiles() {
watch('src/resources/*.js', {ignoreInitial: false, verbose: true}, scripts);
watch('src/resources/*.scss', {ignoreInitial: false, verbose: true}, styles);
}
exports.default = gulp.series(scripts, styles);
exports.watch = gulp.series(scripts, styles, watchFiles);