-
Notifications
You must be signed in to change notification settings - Fork 65
/
gulpfile.js
47 lines (42 loc) · 1.06 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
const gulp = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const concat = require('gulp-concat');
const minifyCSS = require('gulp-csso');
const sourcemaps = require('gulp-sourcemaps');
const minify = require('gulp-minify');
gulp.task('sass', function() {
return gulp
.src(['node_modules/bootstrap/scss/bootstrap.scss'])
.pipe(sass())
.pipe(concat('app.min.css'))
.pipe(minifyCSS())
.pipe(gulp.dest('libs'));
});
gulp.task('scripts', function() {
return gulp
.src([
'node_modules/@popperjs/core/dist/umd/popper.js',
'node_modules/bootstrap/dist/js/bootstrap.js',
'js/main.js'
])
.pipe(sourcemaps.init())
.pipe(concat('app.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('libs'));
});
gulp.task('compress', function() {
return gulp
.src('libs/app.js')
.pipe(
minify({
ext: {
min: '.min.js'
}
})
)
.pipe(gulp.dest('libs'));
});
gulp.task('build', gulp.series('sass', 'scripts', 'compress'));
gulp.task('watch', function() {
return gulp.watch('js/*.js', gulp.series('scripts', 'compress'));
});