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