-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
63 lines (53 loc) · 1.61 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
54
55
56
57
58
59
60
61
62
63
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
// var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var reactify = require('reactify');
var rename = require('gulp-rename');
gulp.task('demo', function () {
var b = browserify({
entries: './docs/demo/run.js',
debug: true,
transform: [[reactify, {es6: true, everything: true}]]
});
return b.bundle()
.pipe(source('./docs/demo/run.js'))
.pipe(buffer())
.pipe(rename('bundle.js'))
.pipe(gulp.dest('./docs/demo/admin/'));
});
gulp.task('javascript', function () {
var b = browserify({
entries: './client/run.js',
debug: true,
transform: [[reactify, {es6: true, everything: true}]]
});
return b.bundle()
.pipe(source('./client/run.js'))
.pipe(buffer())
// .pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
// .pipe(uglify())
// .on('error', gutil.log)
// .pipe(sourcemaps.write('./'))
.pipe(rename('bundle.js'))
.pipe(gulp.dest('./www/'));
});
var less = require('gulp-less');
gulp.task('less', function () {
return gulp.src('./client/less/index.less')
.pipe(less({
// paths: [path.join(__dirname,
}))
.pipe(rename('bundle.css'))
.pipe(gulp.dest('./www'))
});
gulp.task('build', ['less', 'javascript']);
gulp.task('watch', function () {
gulp.watch('client/**/*.js', ['javascript']);
gulp.watch('client/**/*.less', ['less']);
});
gulp.task('default', ['build', 'watch']);