forked from Naveen701372/ng-techgrind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntFile.js
215 lines (188 loc) · 6.32 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
dirs : grunt.file.readJSON('libraries.json'),
closurecompiler: {
jsLibs: {
files: {
// Destination: Sources...
'<%= pkg.production_dirs.dest %>/js/libs.min.closure.js' : '<%= dirs.jsLibs %>'
},
options: {
compilation_level: 'SIMPLE_OPTIMIZATIONS',
language_in: 'ECMASCRIPT5_STRICT'
}
}
},
concat : {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */',
},
mainCss : {
src : '<%= dirs.cssLibs %>',
dest : '<%= pkg.production_dirs.dest %>css/minimum.all.css'
},
mainJs : {
src : '<%= dirs.jsLibs %>',
dest : '<%= pkg.production_dirs.dest %>js/libs.min.js'
}
},
copy: {
html: {
files: [
{
expand: true,
cwd: '<%= pkg.production_dirs.src %>',
src: ['**/*.html'],
dest: '<%= pkg.production_dirs.dest %>'
}
]
},
images: {
files: [
{
expand: true,
cwd: '<%= pkg.production_dirs.src %>img/',
src: ['**/*'],
dest: '<%= pkg.production_dirs.dest %>img'
}
]
},
fonts: {
files: [
{
expand: true,
cwd: '<%= pkg.production_dirs.src %>font/',
src: ['**/*'],
dest: '<%= pkg.production_dirs.dest %>font'
}
]
},
js: {
files: [
{
expand: true,
cwd: '<%= pkg.production_dirs.src %>js/',
src: ['**/*'],
dest: '<%= pkg.production_dirs.dest %>js'
}
]
},
lib: {
files: [
{
expand: true,
cwd: '<%= pkg.production_dirs.src %>lib/',
src: ['**/*'],
dest: '<%= pkg.production_dirs.dest %>lib'
}
]
}
},
htmlmin: {
mainHtml: {// Target
options: {// Target options
removeComments: false,
collapseWhitespace: true
},
files:[
{
expand: true,
cwd: '<%= pkg.production_dirs.dest %>',
src: ['**/*.html'],
dest: '<%= pkg.production_dirs.dest %>'
}
]
}
},
replacer: {
index: {// PRE ENV
options: {
replace: {
'<link rel="stylesheet" href="css/bootplus.min.css">':'<link rel="stylesheet" href="css/minimum.all.css?key=<%= pkg.version %>@<%= new Date().getTime() %>-techGrind">',
'<link rel="stylesheet" href="css/bootplus-responsive.min.css">':'',
'<link rel="stylesheet" href="css/font-awesome.min.css">':'',
'<link rel="stylesheet" href="css/app.css">':'',
'<link rel="stylesheet" href="css/content.css">':'',
'<link rel="stylesheet" href="css/fullcalendar.css">':'',
'<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>' : '<script src="js/libs.min.js"></script>',
'<script src="js/bootstrap.min.js"></script>' : '',
'<script src="lib/jquery/fullcalendar.js"></script>' : '',
'<script src="lib/jquery/gcal.js"></script>' : '',
'<script src="lib/angular/angular.js"></script>' : '',
'<script src="lib/angular/ui-bootstrap-tpls-0.4.0.js"></script>' : '',
'<script src="lib/angular/localStorageModule.js"></script>' : '',
'<script src="js/app.js"></script>' : '',
'<script src="js/services.js"></script>' : '',
'<script src="js/controllers.js"></script>' : '',
'<script src="js/filters.js"></script>' : '',
'<script src="js/directives.js"></script>' : '',
'<script src="js/startupgenome.js"></script>' : '',
'<script src="js/s-expr-log.js"></script>' : ''
}
},
files: [
{src: ['<%= pkg.production_dirs.dest %>index.html'], dest: '<%= pkg.production_dirs.dest %>index.html'}
]
}
},
svgmin: {
img: {// Target
files:[{// Dictionary of files
expand : true, // Enable dynamic expansion.
cwd : '<%= pkg.production_dirs.dest %>img', // Src matches are relative to this path.
src : ['**/*.svg'], // Actual pattern(s) to match.
dest : '<%= pkg.production_dirs.dest %>img/', // Destination path prefix.
ext : '.svg' // Dest filepaths will have this extension.
}]
},
fonts: {// Target
files:[{// Dictionary of files
expand : true, // Enable dynamic expansion.
cwd : '<%= pkg.production_dirs.dest %>font', // Src matches are relative to this path.
src : ['**/*.svg'], // Actual pattern(s) to match.
dest : '<%= pkg.production_dirs.dest %>font/', // Destination path prefix.
ext : '.svg' // Dest filepaths will have this extension.
}]
}
},
coffee: {
mainCoffee: {
files: {// compile and concat into single file
'<%= pkg.production_dirs.src %>js/coffee_result.js':[
'<%= pkg.production_dirs.coffee_src %>js/app.coffee',
'<%= pkg.production_dirs.coffee_src %>js/services.coffee',
'<%= pkg.production_dirs.coffee_src %>js/controllers.coffee',
'<%= pkg.production_dirs.coffee_src %>js/filters.coffee',
'<%= pkg.production_dirs.coffee_src %>js/directives.coffee',
'<%= pkg.production_dirs.coffee_src %>js/startupgenome.coffee'
]
}
}
}
});
// Load the plugin that provides the "concat" task.
grunt.loadNpmTasks('grunt-contrib-concat');
// Load the plugin that provides the "closure compiler" task.
grunt.loadNpmTasks('grunt-closurecompiler');
// Load the plugin that provides the "copy files and folders" task.
grunt.loadNpmTasks('grunt-contrib-copy');
// Load the plugin that provides the "footprint files" task.
grunt.loadNpmTasks('grunt-replacer');
// Load the plugin that provides the "minifyes the html files" task.
grunt.loadNpmTasks('grunt-contrib-htmlmin');
// Load the plugin that provides the "minifyes the html files" task.
grunt.loadNpmTasks('grunt-svgmin');
// Load the plugin that will minify the css
grunt.loadNpmTasks('grunt-css');
// Load the plugin to compile coffeescript
grunt.loadNpmTasks('grunt-contrib-coffee');
// TASK REGISTERS
grunt.registerTask('deployProduction', ['copy:html', 'htmlmin:mainHtml', 'coffee:mainCoffee','closurecompiler:jsLibs', 'copy:images', 'svgmin:img','svgmin:fonts', 'copy:fonts', 'concat:mainCss', 'concat:mainJs', 'replacer:index']);
grunt.registerTask('default', function(arg) {
grunt.log.subhead('.....:::::Options Deploy:::::.....');
grunt.log.writeln('grunt deployProduction');
});
};