forked from concertFriends/concertFriends
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
executable file
·51 lines (47 loc) · 1.36 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
45
46
47
48
49
50
51
const gulp = require('gulp');
const babel = require('babelify');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const browserSync = require('browser-sync');
const reload = browserSync.reload;
const notify = require('gulp-notify');
const sass = require('gulp-sass');
const plumber = require('gulp-plumber');
const concat = require('gulp-concat');
const historyApiFallback = require('connect-history-api-fallback');
gulp.task('styles', () => {
return gulp.src('./dev/styles/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(concat('style.css'))
.pipe(gulp.dest('./public/styles'))
});
gulp.task('js', () => {
return browserify('dev/scripts/app.js', {debug: true})
.transform('babelify', {
sourceMaps: true,
presets: ['env','react']
})
.bundle()
.on('error',notify.onError({
message: "Error: <%= error.message %>",
title: 'Error in JS 💀'
}))
.pipe(source('app.js'))
.pipe(buffer())
.pipe(gulp.dest('public/scripts'))
.pipe(reload({stream:true}));
});
gulp.task('bs', () => {
return browserSync.init({
server: {
baseDir: './'
},
middleware: [historyApiFallback()]
});
});
gulp.task('default', ['bs','js','styles'], () => {
gulp.watch('dev/**/*.js',['js']);
gulp.watch('dev/**/*.scss',['styles']);
gulp.watch('./public/styles/style.css',reload);
});