This repository has been archived by the owner on Nov 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 156
/
Gruntfile.js
166 lines (154 loc) · 3.42 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
157
158
159
160
161
162
163
164
165
166
'use strict';
module.exports = function(grunt) {
// Unified Watch Object
var watchFiles = {
clientViews: ['application/views/**/*.html'],
clientJS: ['assets/js/minera.js'],
clientCSS: ['assets/css/*.css'],
},
applicationFiles = require('./assets/media.json');
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
clientViews: {
files: watchFiles.clientViews,
options: {
livereload: true,
}
},
clientJS: {
files: watchFiles.clientJS,
tasks: ['jshint'],
options: {
livereload: true
}
},
clientCSS: {
files: watchFiles.clientCSS,
tasks: ['csslint'],
options: {
livereload: true
}
},
},
jshint: {
all: {
options: {
jshintrc: true
},
files: {
src: [watchFiles.clientJS],
}
}
},
ngmin: {
production: {
files: {
'assets/js/application.js': [ applicationFiles.js ]
}
}
},
uglify: {
production: {
options: {
mangle: false
},
files: {
'assets/js/application.min.js': 'assets/js/application.js'
}
}
},
cssmin: {
combine: {
files: {
'assets/css/application.min.css': [ applicationFiles.css ]
}
}
},
concurrent: {
default: ['watch'],
debug: ['watch'],
options: {
logConcurrentOutput: true
}
},
copy: {
dist: {
files: [
{
//for glyphicon fonts
expand: true,
cwd: 'assets/vendor/bootstrap/fonts',
src: ['*.*'],
dest: 'assets/fonts/'
},
// Moved to CDN in header file
{
//for font-awesome font
expand: true,
cwd: 'assets/vendor/font-awesome/fonts',
src: ['*.*'],
dest: 'assets/fonts/'
},
{
//for ionicons font
expand: true,
cwd: 'assets/vendor/ionicons/fonts',
src: ['*.*'],
dest: 'assets/fonts/'
}
]
},
},
clean: {
options: { force: true },
stuff: ['assets/fonts/*']
},
bump: {
options: {
files: ['package.json'],
updateConfigs: ['pkg'],
commit: false,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json'],
createTag: false,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: false,
pushTo: 'origin',
gitDescribeOptions: '--always --abbrev=1',
globalReplace: false,
prereleaseName: 'rc',
regExp: false
}
}
});
// Load NPM tasks
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-contrib-clean');
// Making grunt default to force in order not to break the project.
grunt.option('force', true);
// Usage/Help
grunt.registerTask('help', 'Usage', function() {
console.log('Build: grunt build');
});
// Bower and Npm install
grunt.registerTask('install', 'install the backend and frontend dependencies', function() {
var exec = require('child_process').exec;
var cb = this.async();
exec('bower install', {cwd: '.'}, function(err, stdout, stderr) {
cb();
});
});
// Default task(s).
grunt.registerTask('default', ['install', 'lint', 'concurrent:default']);
// Debug task.
grunt.registerTask('debug', ['lint', 'concurrent:debug']);
// Lint task(s).
//grunt.registerTask('lint', ['jshint', 'csslint']);
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('copy:production', ['copy']);
// Build task(s).
grunt.registerTask('build:production', ['lint', 'ngmin:production', 'uglify:production', 'cssmin', 'clean', 'copy']);
};