forked from patrickrb/elite-dangerous-galaxy-map
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
172 lines (163 loc) · 4.88 KB
/
Gruntfile.js
File metadata and controls
172 lines (163 loc) · 4.88 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/**
* Gruntfile.js
*
* Copyright (c) 2012 quickcue
*/
module.exports = function(grunt) {
// Load dev dependencies
require('load-grunt-tasks')(grunt);
// Time how long tasks take for build time optimizations
require('time-grunt')(grunt);
grunt.loadNpmTasks('grunt-wiredep');
grunt.loadNpmTasks('grunt-injector');
grunt.loadNpmTasks('grunt-ng-annotate');
grunt.loadNpmTasks('grunt-contrib-uglify');
// Configure the app path
var base = 'app';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// The actual grunt server settings
express: {
options: {
// Override defaults here
},
dev: {
options: {
port:3000,
script: 'server/edGalaxy.js',
livereload: true
}
}
},
ngAnnotate: {
dev: {
files: { 'public/edGalaxyAnnotate.min.js': ['app/scripts/app.js', 'app/scripts/factories/**/*.js', 'app/scripts/services/**/*.js', 'app/scripts/controllers/main.js', 'app/scripts/directives/**/*.js']
}
}
},
babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: {
'public/edGalaxy.babel.js': 'public/edGalaxyAnnotate.min.js'
}
}
},
uglify: {
dev: {
files: {
'public/edGalaxy.min.js': ['public/edGalaxy.babel.js']
},
options: {
mangle: true
}
}
},
wiredep: {
task: {
// Point to the files that should be updated when
// you run `grunt wiredep`
src: [
'app/index.html', // .html support...
],
options: {
// See wiredep's configuration documentation for the options
// you may pass:
// https://github.com/taptapship/wiredep#configuration
},
overrides:{
'three.js':{
main: ["./build/three.min.js", "./examples/js/controls/TrackballControls.js", "./examples/js/renderers/Projector.js"]
},
'bootstrap':{
main: ["dist/js/bootstrap.min.js", "dist/css/bootstrap.min.css"]
},
'bootswatch': {
main: ["cyborg/bootstrap.css"]
},
'font-awesome':{
main: ["./css/font-awesome.min.css"]
}
}
}
},
injector: {
options: {
transform: function(filePath) {
filePath = filePath.replace('app/', '');
return '<script src="' + filePath + '"></script>';
},
},
local_dependencies: {
files: {
'app/index.html': [
[ 'app/lib/**/*.js',
'app/scripts/app.js',
'app/scripts/controllers/**/*.js',
'app/scripts/factories/**/*.js',
'app/scripts/services/**/*.js',
'app/scripts/directives/**/*.js'
]
]
}
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [ base + '/scripts/**/*.js' ]
},
watch: {
express: {
files: [ 'server/**/*.js' ],
tasks: [ 'express:dev' ],
options: {
spawn: false // for grunt-contrib-watch v0.5.0+, "nospawn: true" for lower versions. Without this option specified express won't be reloaded
}
},
js: {
files: [
'<%= jshint.all %>'
],
tasks: ['jshint'],
options: {
livereload: true
}
},
json: {
files: [
'{package,bower}.json'
],
tasks: ['jsonlint']
}
},
open: {
dev: {
// Gets the port from the connect configuration
path: 'http://localhost:<%= express.dev.options.port%>'
}
}
});
grunt.registerTask('serve', function () {
grunt.task.run([
'express',
'wiredep',
'injector',
'open:dev',
'watch'
]);
});
grunt.registerTask('build', function () {
grunt.task.run([
'wiredep',
'ngAnnotate',
'babel',
'uglify'
]);
});
grunt.registerTask('default', [ 'serve']);
};