-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
79 lines (64 loc) · 1.48 KB
/
gulpfile.babel.js
File metadata and controls
79 lines (64 loc) · 1.48 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import gulp from 'gulp';
import sass from 'gulp-sass';
import connect from 'gulp-connect';
import browserify from 'browserify';
import watchify from 'watchify';
import stringify from 'stringify';
import babelify from 'babelify';
import source from 'vinyl-source-stream';
import autoprefixer from 'gulp-autoprefixer'
import concat from 'gulp-concat';
const autoprefixerOptions = {
browsers: [
"Android 2.3",
"Android >= 4",
"Chrome >= 20",
"Firefox >= 24",
"Explorer >= 8",
"iOS >= 6",
"Opera >= 12",
"Safari >= 6"
]
};
gulp.task('hello', () => {
console.log('Hello World!');
})
gulp.task('connect',() =>{
connect.server();
});
gulp.task('bundle',() => {
let b = browserify({
entries : ['./app/app.js'],
cache : {},
packageCache : {},
plugin : watchify
})
.transform(stringify, {
appliesTo : {
includeExtenstions : ['.html'],
minify : true
}
})
.transform(babelify, {
presets : ['es2015']
})
b.on('update', bundle);
bundle();
function bundle(){
b.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('dist/js'))
}
})
gulp.task('sass', () => {
console.log('Rebundling scss files..')
return gulp.src('./app/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer(autoprefixerOptions))
.pipe(concat('main.css'))
.pipe(gulp.dest('./dist/css'))
});
gulp.task('css', function(){
gulp.watch('app/**/*.scss', ['sass'])
});
gulp.task('default',['connect', 'bundle', 'css']);