forked from GreenDelta/olca-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
104 lines (93 loc) · 2.8 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
var gulp = require('gulp');
var clean = require('gulp-clean');
var runSequence = require('run-sequence');
var fileinclude = require('gulp-file-include');
var zip = require('gulp-zip');
var concat = require('gulp-concat');
var stylus = require('gulp-stylus');
var nib = require('nib');
var jade = require('gulp-jade');
var jadeClient = require('gulp-clientjade');
var coffee = require('gulp-coffee');
gulp.task('default', function() {
runSequence('clean', 'precompile', 'build', 'zip');
});
gulp.task('precompile', ['plugin_manager_scripts', 'plugin_manager_templates', 'plugin_manager_styles']);
gulp.task('build', ['html_pages', 'jade_pages', 'resources', 'libs']);
gulp.task('resources', ['images']);
gulp.task('libs', ['base_libs', 'bootstrap']);
gulp.task('clean', function() {
return gulp.src([
'build',
'dist',
'src/plugin_manager/precompiled'
], {read: false})
.pipe(clean());
});
gulp.task('html_pages', function() {
return gulp.src([
'src/report_view/report_view.html',
'src/start_page/*.html',
'src/bubble_chart/bubble_chart.html',
'src/devtools/*',
'src/*.html'
])
.pipe(fileinclude({
prefix: '//@',
basepath: '@file'
}))
.pipe(gulp.dest('build'));
});
gulp.task('jade_pages', function() {
return gulp.src('src/plugin_manager/jade/plugin_manager.jade')
.pipe(jade({
locals: {}
}))
.pipe(gulp.dest('build'));
});
gulp.task('images', function() {
return gulp.src('images/*')
.pipe(gulp.dest('build/images'));
});
gulp.task('base_libs', function() {
return gulp.src([
'bower_components/angular/angular.min.js',
'bower_components/angular-sanitize/angular-sanitize.min.js',
'bower_components/codemirror/lib/*',
'bower_components/codemirror/mode/javascript/javascript.js',
'bower_components/codemirror/mode/python/python.js',
'bower_components/d3/d3.min.js',
'bower_components/jquery/dist/jquery.min.js',
'other_libs/*.js'
])
.pipe(gulp.dest('build/libs'));
});
gulp.task('bootstrap', function() {
return gulp.src(['bower_components/bootstrap/dist/**'])
.pipe(gulp.dest('build/libs/bootstrap'));
});
gulp.task('plugin_manager_scripts', function() {
return gulp.src('src/plugin_manager/coffeescript/*.coffee')
.pipe(coffee({
bare: true
}))
.pipe(gulp.dest('src/plugin_manager/precompiled'));
});
gulp.task('plugin_manager_templates', function() {
return gulp.src('src/plugin_manager/jade/templates/*.jade')
.pipe(jadeClient('templates.js'))
.pipe(gulp.dest('src/plugin_manager/precompiled'));
});
gulp.task('plugin_manager_styles', function() {
return gulp.src('src/plugin_manager/stylus/*.styl')
.pipe(stylus({
use: [nib()]
}))
.pipe(concat('main.css'))
.pipe(gulp.dest('src/plugin_manager/precompiled'));
});
gulp.task('zip', function() {
return gulp.src('build/**')
.pipe(zip('base_html.zip'))
.pipe(gulp.dest('dist'));
});