forked from blackbaud/barkbaud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.js
54 lines (48 loc) · 1.38 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
/*jshint node: true */
module.exports = function (grunt) {
'use strict';
function addApiConfig() {
var apiConfig,
body,
html,
index;
index = 'ui/index.html';
body = '</body>';
apiConfig = [
"<script>",
"(function () {",
" 'use strict';",
" function config(barkbaudConfig) {",
" barkbaudConfig.apiUrl = '/';",
" }",
" config.$inject = ['barkbaudConfig'];",
" angular.module('barkbaud')",
" .config(config);",
"}());",
"</script>"
];
html = grunt.file.read(index);
html = html.replace(body, apiConfig.join("\n") + body);
grunt.file.write(index, html);
}
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.initConfig({
copy: {
build: {
files: [{
expand: true,
src: ['**/*.*'],
cwd: 'bower_components/barkbaud-ui/build',
dest: 'ui'
}]
}
}
});
// Added the AngularJS config to make the api calls relative
grunt.registerTask('api', addApiConfig);
grunt.registerTask('build', [
'copy:build',
'api'
]);
grunt.registerTask('default', ['build']);
};