-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
80 lines (72 loc) · 2.06 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
var deploy_dir = 'deploy/0-5-1'
var gulp = require('gulp');
var es = require('event-stream');
//var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var htmlreplace = require('gulp-html-replace');
// Minify my
gulp.task('min', function() {
return gulp.src([
'dev/LLL.js',
'dev/BLL_blocks.js',
'dev/LLL_from_BLL.js',
'dev/HLL.js',
'dev/HLL_from_BLL.js',
'dev/storage.js',
'dev/messages.js',
'dev/codemirror_LLL.js',
'dev/codemirror_XML.js',
'dev/codemirror_serpent.js',
'dev/etherscripter.js',
])
.pipe(concat('my.min.js'))
.pipe(uglify())
.pipe(gulp.dest(deploy_dir))
});
// Concat libraries
gulp.task('concat', ['min'], function() {
return gulp.src([
'dev/codemirror_4_2_0.min.js',
'dev/blockly_compressed.js',
'dev/jquery.min.js',
deploy_dir + '/my.min.js',
'dev/bootstrap.min.js',
'dev/samples.js', // these don't min well so concat unminned
])
.pipe(concat('all.min.js'))
.pipe(gulp.dest(deploy_dir))
});
// Stage others
gulp.task('stage', function() {
return es.merge(
gulp.src([
'dev/*.ico',
])
.pipe(gulp.dest('deploy/')),
gulp.src([
'dev/*.html',
'dev/*.css',
'dev/media/**/*.*',
'dev/sales_contract.png',
],
{base: 'dev/'}
)
.pipe(gulp.dest(deploy_dir))
)
});
// Fix Refs
gulp.task('fixrefs', ['stage'], function() {
gulp.src('dev/index.html')
.pipe(htmlreplace({
'js': 'all.min.js'
}))
.pipe(gulp.dest(deploy_dir));
});
// Watch Files For Changes
// gulp.task('watch', function() {
// gulp.watch('dev/*.js', ['concat']);
// });
// Default Task
gulp.task('default', [/* 'lint',*/ 'min', 'concat', 'stage', 'fixrefs']);