-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
136 lines (107 loc) · 4.08 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
module.exports = function (grunt) {
"use strict";
var moduleFilePrefix = 'ttui-clm-';
var moduleName ='fxl-select-offering';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
html: {
index: 'src/'+moduleName+'/index.html',
indexCtrl:'src/'+moduleName+'/indexCtrl.js',
directive:'src/'+moduleName+'/directive/'+moduleName+'.tpl.html'
},
applicationJs: {
app: 'src/'+moduleName+'/app.js',
controller: 'src/'+moduleName+'/controller/'+moduleName+'-ctrl.js',
directive: 'src/'+moduleName+'/directive/'+moduleName+'-directive.js',
services: 'src/'+moduleName+'/services/'+moduleName+'-services.js'
},
// Cleanup, remove files and folders not needed after cleanup:
clean: {
build: {
files: [{
src: ['dist/'], //distribution
}]
}
},
// It converting minify and Unminify css and JS Path and moving All HTML File in Dist Folder:
processhtml: {
dev: {
options: {
data: {
message: 'This is development environment'
}
},
files: {
'dist/index.html': '<%= html.index %>',
'dist/directive/fxl-select-offering.tpl.html':'<%= html.directive %>'
}
}
},
// compile scss stylesheets to css -----------------------------------------
// Sass configuration:
sass: {
dev: {
files: [{
expand: true,
cwd: 'src/'+moduleName+'/scss',
src: ['*.scss'],
dest: 'dist/css',
ext: '.css'
}]
}
},
//Concat Multiple js/ Css files to concatenate
concat: {
options: {
banner:
'/* commonjs package manager support (eg componentjs) */\n' +
'if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){\n' +
' module.exports = \'@@@@__SOURCE_FILENAME__\';\n' +
'}\n\n' +
'(function (window, angular, undefined) {\n' +
' "use strict";\n\n',
footer:
'\n'+
'return angular;\n'+
'})(window, window.angular);',
sourceMap: false, // uglify does this
process: function(src, filepath) {
return '\n// Source: ' + filepath + '\n' + src.replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1');
}
},
dev: {
files: {
//login page script file
'dist/js/fxl-select-offering.js': [
'<%= applicationJs.app %>',
'<%= applicationJs.controller %>',
'<%= applicationJs.directive %>',
'<%= applicationJs.services %>'
]
}
}
},
// copying all source file into dist file.
copy: {
// allFiles: {
// expand: true,
// cwd: 'src/fxl-select-offering',
// src: ['**'],
// dest: 'dist'
// },
images: {
expand: true,
cwd: 'src/fxl-select-offering/images',
src: ['**'],
dest: 'dist/images'
}
},
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-processhtml');
// This task will only run the dev Environment configuration
grunt.registerTask('build', ['clean', 'copy', 'processhtml', 'sass', 'concat']);
};