-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgulpfile.js
49 lines (43 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
// including plugins
var gulp = require('gulp')
var concat = require("gulp-concat");
var eslint = require('gulp-eslint');
var babelify = require('babelify');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var cachebust = require('gulp-cache-bust');
var distFolder = "./dist";
// task
gulp.task('concat:css', function () {
gulp.src(["css/*.css", "components/*.css"])
.pipe(concat('styles.css'))
.pipe(gulp.dest(distFolder));
});
gulp.task('eslint', function () {
gulp.src(["components/*.jsx", "dataaccess/*.js", "stores/*.js", "main.js"])
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('scripts', function () {
return browserify({
entries: 'main.js'
})
.transform(babelify.configure({
presets : ["es2015", "react"]
}))
.bundle()
.pipe(source('scripts.js'))
.pipe(gulp.dest(distFolder));
});
gulp.task('cachebust', function () {
gulp.src('index.html')
.pipe(cachebust({
type: 'timestamp'
}))
.pipe(gulp.dest(distFolder));
});
gulp.task('watch', function () {
gulp.watch(["components/*.jsx", "dataaccess/*.js", "stores/*.js", "main.js"], [ "eslint", "scripts", "cachebust" ]);
gulp.watch(["css/*.css"], [ "concat:css" ]);
});
gulp.task( 'default', [ "eslint", "scripts", "concat:css", "cachebust" ] )