-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (40 loc) · 1.11 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const browserSync = require('browser-sync').create();
const sourcemaps = require('gulp-sourcemaps');
const babel = require('gulp-babel');
const concat = require('gulp-concat');
const gcmq = require('gulp-group-css-media-queries');
gulp.task('sass', function() {
return gulp
.src('./src/sass/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
cascade: false,
grid: true
}))
.pipe(gcmq())
.pipe(gulp.dest('./dist'))
.pipe(browserSync.stream());
});
gulp.task('js', function() {
return gulp
.src('./src/js/*.js')
.pipe(sourcemaps.init())
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(concat('index.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./dist'))
.pipe(browserSync.stream());
});
gulp.task('watch', function () {
browserSync.init({
server:'./dist'
});
gulp.watch('./src/sass/**/*.scss', gulp.series('sass'));
gulp.watch('./src/js/**/*.js', gulp.series('js'));
gulp.watch("./dist/*.html").on("change", browserSync.reload);
});