-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.babel.js
48 lines (41 loc) · 1.31 KB
/
gulpfile.babel.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
45
46
47
48
import gulp from 'gulp'
import sass from 'gulp-sass'
import sourcemaps from 'gulp-sourcemaps'
import eslint from 'gulp-eslint'
import concat from 'gulp-concat'
import babel from 'gulp-babel'
import uglify from 'gulp-uglify'
import del from 'del'
import livereload from 'gulp-livereload'
const dirs = {
dest: 'public/assets/',
src: 'src/',
styles: 'src/styles/',
scripts: 'src/scripts/',
libs: 'src/libs/',
clean: ['public/assets/**/*.js', 'public/assets/**/*.css', 'public/assets/**/*.map']
}
export const clean = () => del(dirs.clean)
export const styles = () =>
gulp.src(`${dirs.styles}app.scss`, { sourcemaps: true })
.pipe(sass.sync().on('error', sass.logError))
.pipe(gulp.dest(dirs.dest))
export const scripts = () =>
gulp.src(`${dirs.scripts}**/*.js`, { sourcemaps: true })
.pipe(eslint())
.pipe(babel({
presets: ['es2015'],
}))
.pipe(gulp.dest(dirs.dest))
export const libs = () =>
gulp.src(`${dirs.libs}**/*.js`)
.pipe(gulp.dest(dirs.dest))
export const reload = () => livereload.reload()
export const watch = () => {
livereload.listen()
gulp.watch(`${dirs.styles}**/*.scss`, styles)
gulp.watch(`${dirs.scripts}**/*.js`, scripts)
gulp.watch('public/**/*', reload)
}
export const build = gulp.parallel(styles, libs, scripts)
export default gulp.parallel(watch, build)