forked from terkelg/ramme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
42 lines (34 loc) · 934 Bytes
/
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
import {src, dest, watch as watchSrc, parallel, series} from 'gulp'
import babel from 'gulp-babel'
import del from 'del'
import sass from 'gulp-sass'
// Directories
const SRC_DIR = 'app/src'
const DIST_DIR = 'app/dist'
// Source files
const JS_GLOB = `${SRC_DIR}/**/*.js`
const CSS_GLOB = `${SRC_DIR}/**/*.scss`
// Clean DIST directory
export function clean () {
return del([DIST_DIR])
}
// JS Task
export function scripts () {
return src(JS_GLOB, {base: SRC_DIR})
.pipe(babel())
.pipe(dest(DIST_DIR))
}
export function styles () {
return src(CSS_GLOB, {base: SRC_DIR})
.pipe(sass().on('error', sass.logError))
.pipe(dest(DIST_DIR))
}
export function watch () {
watchSrc(JS_GLOB, scripts)
watchSrc(CSS_GLOB, styles)
}
const mainTasks = parallel(scripts, styles)
export const build = series(clean, mainTasks)
export const dev = series(clean, mainTasks, watch)
// Set default task
export default build