-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
156 lines (147 loc) · 7.59 KB
/
Gruntfile.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
module.exports = function(grunt) {
targethtmlFiles = {
// Example:
// 'public/foo.html': 'src/bar.html'
// means: compile src/bar.html to public/foo.html
//
// Frontend
'public/frontend/index.html' : 'src/frontend/index.html',
'public/frontend/remote.html' : 'src/frontend/remote.html',
'public/frontend/webRTC.html' : 'src/frontend/webRTC.html',
'public/frontend/js/frontend.js' : 'src/frontend/js/frontend.js',
'public/frontend/js/overlayPlugin.js' : 'src/frontend/js/overlayPlugin.js',
'public/frontend/js/remote.js' : 'src/frontend/js/remote.js',
'public/frontend/js/webRTC.js' : 'src/frontend/js/webRTC.js',
'public/frontend/js/chromaKeyPlugin.js' : 'src/frontend/js/chromaKeyPlugin.js',
'public/frontend/css/frontend.css' : 'src/frontend/css/frontend.css',
// Remote
'public/remote/index.html' : 'src/remote/index.html',
'public/remote/js/remote.js' : 'src/remote/js/remote.js',
'public/remote/js/views/LocationsListView.js' : 'src/remote/js/views/LocationsListView.js',
'public/remote/css/remote.css' : 'src/remote/css/remote.css',
'public/remote/templates/locationsListView.tpl' : 'src/remote/templates/locationsListView.tpl',
// Backend
'public/backend/index.html' : 'src/backend/index.html',
'public/backend/js/backend.js' : 'src/backend/js/backend.js',
'public/backend/css/backend.css' : 'src/backend/css/backend.css',
'public/backend/templates/locationMarkerView.tpl' : 'src/backend/templates/locationMarkerView.tpl',
'public/backend/templates/locationEditView.tpl' : 'src/backend/templates/locationEditView.tpl',
'public/backend/templates/overlayEdit.tpl' : 'src/backend/templates/overlayEdit.tpl',
'public/backend/templates/aboutView.tpl' : 'src/backend/templates/aboutView.tpl',
'public/backend/js/models/Location.js' : 'src/backend/js/models/Location.js',
'public/backend/js/models/Locations.js' : 'src/backend/js/models/Locations.js',
'public/backend/js/models/Overlay.js' : 'src/backend/js/models/Overlay.js',
'public/backend/js/models/Overlays.js' : 'src/backend/js/models/Overlays.js',
'public/backend/js/models/Video.js' : 'src/backend/js/models/Video.js',
'public/backend/js/models/Videos.js' : 'src/backend/js/models/Videos.js',
'public/backend/js/views/LocationEditView.js' : 'src/backend/js/views/LocationEditView.js',
'public/backend/js/views/LocationMarkerView.js' : 'src/backend/js/views/LocationMarkerView.js',
'public/backend/js/views/MapView.js' : 'src/backend/js/views/MapView.js',
'public/backend/js/views/MarkerView.js' : 'src/backend/js/views/MarkerView.js',
'public/backend/js/views/OverlayEditView.js' : 'src/backend/js/views/OverlayEditView.js',
'public/backend/js/views/AboutView.js' : 'src/backend/js/views/AboutView.js',
'public/backend/js/views/RouteView.js' : 'src/backend/js/views/RouteView.js'
};
copyFiles = [
{expand: true, flatten: true, src: ['src/backend/images/**'], dest: 'public/backend/images/', filter: 'isFile'},
{expand: true, flatten: true, src: ['src/frontend/images/**'], dest: 'public/frontend/images/', filter: 'isFile'},
{expand: true, flatten: true, src: ['src/remote/images/**'], dest: 'public/remote/images/', filter: 'isFile'}
];
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
targethtml: {
master: {
files: targethtmlFiles
},
develop: {
files: targethtmlFiles
},
developOnServer: {
files: targethtmlFiles
}
},
jsdoc: {
all: {
src: ['README.md', 'src/frontend/js/*.js', 'src/backend/js/*.js'],
dest: 'public/doc',
options: {
template : 'node_modules/ink-docstrap/template',
configure : 'node_modules/ink-docstrap/template/jsdoc.conf.json'
}
}
},
concat: {
options: {
separator: '\n\n'
},
backendCSS: {
src: ['public/lib/*/css/*.css', 'public/backend/css/*.css'],
dest: 'public/backend/css/backend.css'
},
frontendCSS: {
src: ['public/lib/*/css/*.css', 'public/frontend/css/*.css'],
dest: 'public/frontend/css/frontend.css'
},
remoteCSS: {
src: ['public/lib/*/css/*.css', 'public/remote/css/*.css'],
dest: 'public/remote/css/remote.css'
}
},
copy: {
all: {
files: copyFiles
}
},
jsbeautifier: {
all: {
src : ['src/**/*.js', 'src/**/*.css', 'src/**/*.html'],
options: {
html: {
braceStyle: 'collapse',
indentChar: ' ',
indentScripts: 'keep',
indentSize: 4,
maxPreserveNewlines: 10,
preserveNewlines: true,
unformatted: [],
wrapLineLength: 0
},
css: {
indentChar: ' ',
indentSize: 4
},
js: {
braceStyle: 'collapse',
breakChainedMethods: true,
e4x: false,
evalCode: false,
indentChar: ' ',
indentLevel: 0,
indentSize: 4,
indentWithTabs: false,
jslintHappy: false,
keepArrayIndentation: false,
keepFunctionIndentation: false,
maxPreserveNewlines: 10,
preserveNewlines: true,
spaceBeforeConditional: true,
spaceInParen: false,
unescapeStrings: false,
wrapLineLength: 0
}
}
}
}
});
// Load the plugin that provides the xyz task.
grunt.loadNpmTasks('grunt-targethtml');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-jsbeautifier');
// Default task(s).
grunt.registerTask('master', ['jsbeautifier:all', 'targethtml:master', 'copy:all', 'concat:backendCSS', 'concat:frontendCSS', 'concat:remoteCSS', 'jsdoc:all']);
grunt.registerTask('develop', ['jsbeautifier:all', 'targethtml:develop', 'copy:all', 'concat:backendCSS', 'concat:frontendCSS', 'concat:remoteCSS']);
grunt.registerTask('developOnServer', ['jsbeautifier:all', 'targethtml:developOnServer', 'copy:all', 'concat:backendCSS', 'concat:frontendCSS', 'concat:remoteCSS', 'jsdoc:all']);
};