-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
51 lines (42 loc) · 1.24 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
//
// gulpfile.js
// Gulp for MDX
// Date: 23.11.2014
// (с) 2014, Andrey Gershun
//
var gulp = require('gulp');
module.exports = gulp;
var concat = require('gulp-concat-sourcemap');
var shell = require('gulp-shell')
gulp.task('js-merge', function () {
return gulp.src([
'./src/mdx10start.js',
'./src/alamdxparser.js',
'./src/mdx15alamdx.js',
'./src/mdx90finish.js'])
.pipe(concat('alamdx.js'))
.pipe(gulp.dest('./'))
});
gulp.task('jison-compile', function () {
return gulp.src('./src/*.jison', {read: false})
.pipe(shell([
'jison ./src/alamdxparser.jison -o ./src/alamdxparser.js',
]));
});
gulp.task('uglify', function () {
return gulp.src('./alamdx.js', {read: false})
.pipe(shell([
'uglifyjs alamdx.js -o alamdx.min.js',
]));
});
gulp.task('copy-dist', function(){
gulp.src(['./alamdx.js','./alamdx.min.js','./alamdx.js.map'])
.pipe(gulp.dest('dist'));
});
// Main task
gulp.task('default', ['js-merge'], function(){
gulp.watch('./src/*.js',function(){ gulp.run('js-merge'); });
gulp.watch('./src/*.jison',function(){ gulp.run('jison-compile'); });
gulp.watch('./alamdx.js',function(){ gulp.run('uglify'); });
gulp.watch('./alamdx.min.js',function(){ gulp.run('copy-dist'); });
});