-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
40 lines (35 loc) · 1.06 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
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var babel = require('gulp-babel');
var strip = require('gulp-strip-comments');
var rename = require("gulp-rename");
gulp.task('build', () => {
return gulp.src('lib/scripty.js')
.pipe(strip())
.pipe(babel({
presets: ['babili'],
plugins: ["babel-plugin-transform-undefined-to-void" ,"transform-minify-booleans"]
}))
.pipe(rename("scripty.min.js"))
.pipe(gulp.dest('dist'))
});
gulp.task('html', function() {
return gulp.src('test/*.html')
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('browserSync', function() {
browserSync.init({
server: {
baseDir: './'
},
startPath: 'test/test.html',
browser: 'chrome'
})
});
gulp.task('watch', ['build', 'browserSync', 'html'], function() {
// Reloads the browser whenever HTML or JS files change
gulp.watch('lib/*.js', browserSync.reload);
gulp.watch('test/*.*', browserSync.reload);
});