-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
44 lines (36 loc) · 1.16 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
var gulp = require("gulp");
var browserify = require("browserify");
var source = require("vinyl-source-stream");
var babelify = require("babelify");
var uglify = require("gulp-uglify");
var rename = require("gulp-rename");
var concat = require("gulp-concat");
var minifyCss = require("gulp-minify-css");
var streamify = require('gulp-streamify');
var babel = require("gulp-babel");
var environments = require('gulp-environments');
var production = environments.production;
function compiler(parm) {
if (parm && parm.path && parm.rename) {
parm.dest = parm.dest ? parm.dest : './dist';
browserify(parm.path)
.transform('babelify', { presets: ['react'] })
.bundle()
.pipe(source(parm.path))
.pipe(streamify(uglify()))
.pipe(rename(parm.rename))
.pipe(gulp.dest(parm.dest));
}
}
gulp.task('compress', function () {
gulp.src('./css/*.css')
.pipe(concat('megBoard.min.css'))
.pipe(minifyCss())
.pipe(gulp.dest('./dist/'))
})
gulp.task('build', ['compress'], function () {
compiler({
path: './app.js',
rename: 'megBoard.min.js'
});
})