-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
37 lines (30 loc) · 894 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
import gulp from 'gulp';
import babel from 'gulp-babel';
import sass from 'gulp-sass';
import sourcemaps from 'gulp-sourcemaps';
import fs from 'fs';
const parsed = JSON.parse(fs.readFileSync('./package.json'));
// Assets source files path
const paths = {
sass: 'src/sass/**/*.scss',
script: 'src/js/**/*.js'
};
gulp.task('sass', () => {
return gulp.src(paths.sass)
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/css'));
});
gulp.task('transpile', () => {
return gulp.src(paths.script)
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/js'));
});
gulp.task('watch', () => {
gulp.watch(paths.script, ['transpile']);
gulp.watch(paths.sass, ['sass']);
});
gulp.task('default', ['watch', 'transpile', 'sass']);