-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
51 lines (44 loc) · 1.19 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
const
gulp = require('gulp'),
pug = require('gulp-pug'),
jsx = require('gulp-jsx'),
babel = require('gulp-babel'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
preprocess = require('gulp-preprocess');
gulp.task('html', function(){
return gulp.src('___src/views/*.pug')
.pipe(pug({ pretty: true }))
.pipe(gulp.dest('__build'))
});
gulp.task('copy-sources', function() {
return gulp
.src([
'node_modules/requirejs/require.js',
'node_modules/redux/dist/redux.min.js',
'node_modules/react/dist/react.min.js',
'node_modules/react-dom/dist/react-dom.min.js'
])
.pipe(uglify())
.pipe(gulp.dest('__build'));
});
gulp.task('jsx', function(){
return gulp.src('___src/assets/javascripts/*.jsx')
.pipe(babel({
presets: ["es2015", "react"]
}))
// .pipe(uglify())
.pipe(gulp.dest('__build'))
});
gulp.task('js', function(){
return gulp.src('___src/assets/javascripts/*.js')
.pipe(preprocess({ context: { NOCACHE_STAMP: Math.random() } }))
.pipe(babel({ presets: ["es2015"] }))
// .pipe(uglify())
.pipe(gulp.dest('__build'))
});
gulp.task('default', [
'html',
'js', 'jsx',
'copy-sources'
]);