-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgulpfile.js
106 lines (92 loc) · 2.9 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
'use strict';
//libraries
var pkg = require('./package.json'),
mkdirp = require('mkdirp'),
gulp = require('gulp');
//paths
var paths = {
root: __dirname,
sources: {
root: 'src/',
layouts: 'src/templates/layouts/',
partials: 'src/templates/partials/*.hbs',
pages: 'src/templates/pages/*.hbs',
data: 'src/data/',
scripts: 'src/scripts/',
styles: 'src/styles/',
fonts: 'fonts/', // src/fonts/
images: 'img/' // src/img/
},
build: {
root: 'dist',
www: 'dist/www/',
data: 'dist/www/data',
js: 'dist/www/js/',
css: 'dist/www/css',
fonts: 'dist/www/fonts/',
images: 'dist/www/img/',
scss: 'dist/www/css/src/styles/',
cordova: 'dist/cordova/',
cordova_www: 'dist/cordova/www/'
}
};
//urls
var urls = {
fisl: {
gridXML: 'http://papers.softwarelivre.org/papers_ng/public/fast_grid?event_id=4',
gridHTML: 'http://papers.softwarelivre.org/papers_ng/public/new_grid?day=7'
}
};
//gulp tasks libraries
var WebTasks = require('./src/scripts/gulp-tasks/web'),
CordovaTasks = require('./src/scripts/gulp-tasks/cordova'),
FISLTasks = require('./src/scripts/gulp-tasks/fisl'),
tasks = {
web: new WebTasks(paths),
cordova: new CordovaTasks(paths, pkg),
fisl: new FISLTasks(paths, urls)
};
// tasks
gulp.task('createBuildDir', function(cb){
mkdirp(paths.build.root, function(err) {
if(err){ throw err; }
cb(null);
});
});
// fisl
gulp.task('fisl:fetchXML', tasks.fisl.fetchXML);
gulp.task('fisl:buildJSON', tasks.fisl.buildJSON);
//web
gulp.task('web:buildData', tasks.web.buildData);
gulp.task('web:bundleScripts', tasks.web.bundleScripts);
gulp.task('web:copyExtraLibraries', tasks.web.copyExtraLibraries);
gulp.task('web:buildScripts',
[
'web:bundleScripts',
'web:copyExtraLibraries'
]
);
gulp.task('web:copyAssets', tasks.web.copyAssets);
gulp.task('web:buildStyles',
[
'web:copyAssets'
], tasks.web.buildStyles);
gulp.task('web:buildPages', tasks.web.buildPages);
gulp.task('web:build',
[
'web:buildData',
'web:buildScripts',
'web:buildStyles',
'web:buildPages'
]
);
//cordova
gulp.task('cordova:create', ['createBuildDir'], tasks.cordova.create);
gulp.task('cordova:addAndroid', ['cordova:create'], tasks.cordova.addAndroid);
gulp.task('cordova:addPlugins', ['cordova:addAndroid'], tasks.cordova.addPlugins);
gulp.task('cordova:setup',['cordova:addPlugins'], tasks.cordova.setup);
gulp.task('cordova:build', ['web:build'], tasks.cordova.build);
gulp.task('cordova:run', tasks.cordova.run);
gulp.task('cordova:release', tasks.cordova.release);
//default
gulp.task('default', function() {});