-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (35 loc) · 1.05 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
var gulp = require('gulp'),
less = require('gulp-less'),
browserSync = require('browser-sync'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename'),
cleanCSS = require('gulp-clean-css'),
autoprefixer = require('gulp-autoprefixer');
gulp.task('less', function(){
return gulp.src('less/style.less')
.pipe(plumber())
.pipe(less())
.pipe(cleanCSS())
.pipe(rename(function (path) {
path.dirname += "/../css";
path.extname = ".min.css";
}))
.pipe(autoprefixer({overrideBrowserslist: ['last 5 versions']}))
.pipe(cleanCSS({compatibility: 'ie10', keepSpecialComments: 1}))
.pipe(gulp.dest('css'))
.pipe(browserSync.reload({stream: true}))
});
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: './'
},
notify: false
});
});
gulp.task('watch', function() {
gulp.watch('less/**/*.less', gulp.parallel('less'));
gulp.watch(['index.html']);
gulp.watch(['img/**/*']);
});
gulp.task('default', gulp.parallel("less", 'browser-sync', 'watch'));