-
Notifications
You must be signed in to change notification settings - Fork 27
/
gulpfile.js
50 lines (45 loc) · 1.17 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
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'));
});
gulp.task('scripts', function() {
return gulp
.src([
'node_modules/@popperjs/core/dist/umd/popper.js',
'node_modules/bootstrap/dist/js/bootstrap.js',
'dev_js/main-theme.js'
])
.pipe(sourcemaps.init())
.pipe(concat('app.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('resources'));
});
gulp.task('compress', function() {
return gulp
.src('resources/app.js')
.pipe(
minify({
ext: {
src: '-debug.js',
min: '.min.js'
},
exclude: ['tasks'],
ignoreFiles: ['.combo.js', '-min.js']
})
)
.pipe(gulp.dest('resources'));
});
gulp.task('build', gulp.series('sass', 'scripts', 'compress'));
gulp.task('watch', function() {
return gulp.watch('dev_js/**/*.js', gulp.series('scripts', 'compress'));
});