forked from EmergenSea/Moodsong
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·53 lines (48 loc) · 1.26 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
52
53
const gulp = require('gulp');
const sass = require('gulp-sass');
const browserSync = require('browser-sync').create();
const reload = browserSync.reload;
const concat = require('gulp-concat');
const babel = require('gulp-babel');
const autoprefixer = require('gulp-autoprefixer');
// SASS INTO CSS W/ AUTOPREFIXING
gulp.task('sass', () => {
return gulp
.src('dev/styles/styles.scss')
.pipe(sass().on('error', sass.logError)) // converts sass to css with gulp-sass
.pipe(autoprefixer('last 2 versions'))
.pipe(gulp.dest('public/styles/'))
.pipe(
reload({
stream: true
})
);
});
// WATCHING FOR FILE CHANGES
gulp.task('watch', ['browser-sync'], () => {
gulp.watch('dev/styles/**/*.scss', ['sass']);
gulp.watch('*.html', reload);
gulp.watch('dev/scripts/**/*.js', reload);
});
// BROWSER-SYNC / LIVE RELOADING
gulp.task('browser-sync', () => {
browserSync.init({
server: {
baseDir: ''
}
});
});
// ES6 TO ES5
gulp.task('scripts', () => {
gulp
.src('dev/scripts/script.js')
.pipe(
babel({
presets: ['env']
})
)
.pipe(gulp.dest('public/scripts/'))
.pipe(reload({ stream: true }));
});
// ALL TASKS INTO ONE INIT
gulp.task('default', ['browser-sync', 'sass', 'scripts', 'watch']);