forked from rockSteadyyy/vic-stefan_project4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (44 loc) · 1.35 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const concat = require('gulp-concat');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const notify = require('gulp-notify');
const browserSync = require('browser-sync');
const reload = browserSync.reload;
gulp.task('styles', () => {
return gulp.src('./dev/styles/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(concat('style.css'))
.pipe(gulp.dest('./public/styles'))
.pipe(reload({stream: true}));
});
gulp.task('js', () => {
browserify('./dev/scripts/main.js', { debug: true })
.transform('babelify', {
sourceMaps: true,
presets: ['env']
})
.bundle()
.on('error', notify.onError({
message: "Error: <%= error.message %>",
title: 'Error in JS 💀'
}))
.pipe(source('main.js'))
.pipe(buffer())
.pipe(gulp.dest('./public/scripts'))
.pipe(reload({stream: true}));
});
gulp.task('bs', () => {
browserSync.init({
server: {
baseDir: './'
}
})
});
gulp.task('watch', () => {
gulp.watch('./dev/styles/**/*.scss',['styles']);
gulp.watch('./dev/scripts/**/*.js', ['js'])
});
gulp.task('default',['bs', 'styles', 'js', 'watch']);