-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
44 lines (38 loc) · 1.25 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
const gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('autoprefixer')
postcss = require('gulp-postcss'),
cssnano = require('gulp-cssnano'),
uglify = require('gulp-uglify');
//compile sass
gulp.task('sass', function() {
return gulp.src('wp-content/themes/bubbo2020/src/scss/**/*.scss')
.pipe(sass())
.pipe(gulp.dest('wp-content/themes/bubbo2020/dist/css/'))
});
//compile on save
gulp.task('watch', function() {
gulp.watch('wp-content/themes/bubbo2020/src/scss/**/*.scss', gulp.series('sass'));
});
//minifies js
gulp.task('minify-js', function() {
return gulp.src('wp-content/themes/bubbo2020/src/js/**/*.js')
.pipe(uglify())
.pipe(gulp.dest('wp-content/themes/bubbo2020/dist/js/'))
});
//minifies css
gulp.task('minify-css', function() {
return gulp.src('wp-content/themes/bubbo2020/src/scss/**/*.scss')
.pipe(sass())
.pipe(postcss([ autoprefixer({
overrideBrowserslist: ['last 2 versions'],
cascade: false
}) ]))
.pipe(cssnano())
.pipe(gulp.dest('wp-content/themes/bubbo2020/dist/css/'))
});
//builds everything
gulp.task('build', gulp.series('sass', 'minify-css', 'minify-js', function(done) {
console.log('Building and...all done!');
done();
}));