-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
40 lines (35 loc) · 1.09 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
const gulp = require('gulp');
const concat = require('gulp-concat');
const autoprefixer = require('gulp-autoprefixer');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
function htmls() {
return gulp.src('./src/index.html')
.pipe(gulp.dest('./build'));
}
function styles() {
return gulp.src('./src/css/style.css')
.pipe(autoprefixer({
overrideBrowserlist: ['> 1%'],
cascade: false
}))
.pipe(gulp.dest('./build/css'));
}
function scripts() {
return gulp.src(['./src/js/main.js', './src/js/setupFunction.js', './src/js/additionalFunctions.js'])
.pipe(concat('script.js'))
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(uglify())
.pipe(gulp.dest('./build/js'));
}
function watch() {
gulp.watch('./src/*.html', htmls);
gulp.watch('./src/css/**/*.css', styles);
gulp.watch('./src/js/**/*.js', scripts);
}
gulp.task('htmls', htmls);
gulp.task('styles', styles);
gulp.task('scripts', scripts);
gulp.task('watch', watch);