forked from mercadolibre/payment-methods-component
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
63 lines (49 loc) · 1.74 KB
/
Gruntfile.js
File metadata and controls
63 lines (49 loc) · 1.74 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
module.exports = function(grunt) {
var country = grunt.option('country'),
size = grunt.option('size') || 'default',
files = [
'css/payment-methods.css',
'css/countries/' + country + '/payment-methods.css'
],
sizeCollection = size.split(','),
destination = 'build/payment-methods.' + country + '__' + size + '.css'
sizeCollection.forEach(function (e) {
files.push('css/countries/' + country + '/' + e + '/payment-methods.css');
});
if (sizeCollection.length > 1) {
// Rename file when all sizes
destination = destination.replace(size, 'all');
}
// Project configuration.
grunt.initConfig({
'pkg': grunt.file.readJSON('package.json'),
'concat': {
'build': {
'src': files,
'dest': destination
}
},
'copy': {
'main': {
'files': [{
'expand': true,
// Source folder
'cwd': 'build/',
// Source files
'src': ['payment-methods.' + country + '__default.css'],
// Destination folder
'dest': 'dist/',
'rename': function (dest, src) {
return dest + src.replace(/__default/, '');
}
}]
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task(s).
grunt.registerTask('default', []);
grunt.registerTask('build', ['concat']);
grunt.registerTask('dist', ['build', 'copy']);
};