-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·34 lines (31 loc) · 920 Bytes
/
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
const gulp = require('gulp');
const plumber = require('gulp-plumber');
const autoprefixer = require('gulp-autoprefixer');
const imagemin = require('gulp-imagemin');
const sass = require('gulp-sass');
const cleanCSS = require('gulp-clean-css');
const rename = require('gulp-rename');
gulp.task('images', () => {
return gulp
.src(['./img/original/*.{png,jpg,svg}'])
.pipe(imagemin())
.pipe(gulp.dest('./img'));
});
gulp.task('styles', () => {
return gulp
.src(['scss/**/*.scss'])
.pipe(
plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
},
})
)
.pipe(sass())
.pipe(autoprefixer({ browsers: ['last 2 versions'], cascade: false }))
.pipe(cleanCSS({ compatibility: 'ie8' }))
.pipe(rename('style.css'))
.pipe(gulp.dest('css'));
});
gulp.task('default', gulp.parallel('styles', 'images'));