-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
43 lines (38 loc) · 1.69 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
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
babel = require('gulp-babel'),
browserify = require('gulp-browserify'),
util = require('gulp-util'),
sass = require('gulp-sass');
gulp.task('build-editor', function () {
return gulp.src('resources/js/editor/**/*.js')
.pipe(concat('editor-bundle.js'))
.pipe(browserify())
.pipe(util.env.production ? babel({
presets: ['es2015']
}) : util.noop())
.pipe(util.env.production ? uglify() : util.noop())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('static/'));
});
gulp.task('build-all-editor-modes', function () {
return gulp.src(['node_modules/codemirror/addon/mode/simple.js', 'node_modules/codemirror/mode/*/*.js'])
.pipe(util.env.production ? uglify() : util.noop())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('static/codemirror'));
});
gulp.task('build-editor-vim-keymap-mode', function () {
return gulp.src(['node_modules/codemirror/keymap/vim.js'])
.pipe(util.env.production ? uglify() : util.noop())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('static/codemirror'));
});
gulp.task('build-sass', function () {
return gulp.src(['resources/sass/**/*.scss', 'node_modules/codemirror/addon/dialog/dialog.css'])
.pipe(concat('bundle.min.css'))
.pipe(sass())
.pipe(gulp.dest('static/'))
});
gulp.task('build', ['build-sass', 'build-all-editor-modes', 'build-editor-vim-keymap-mode'])