-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
44 lines (39 loc) · 1.07 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 { src, dest, watch } = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const cssnano = require('gulp-cssnano');
const babel = require('gulp-babel');
const concat = require('gulp-concat');
const sourcemaps = require('gulp-sourcemaps');
const browserSync = require('browser-sync').create();
function css() {
return src('./scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(cssnano())
.pipe(sourcemaps.write('.'))
.pipe(dest('./'))
.pipe(browserSync.stream());
}
function js() {
return src('./js/*.js', { sourcemaps: true })
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(concat('build.min.js'))
.pipe(dest('./js/min', { sourcemaps: true }));
}
function browser() {
css();
js();
browserSync.init({
proxy: 'child.local',
files: [
'./**/*.php'
]
});
watch('./scss/**/*.scss', css);
watch('./js/*.js', js).on('change', browserSync.reload);
}
exports.css = css;
exports.js = js;
exports.default = browser;