-
Notifications
You must be signed in to change notification settings - Fork 23
/
Gruntfile.js
126 lines (122 loc) · 3.14 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
module.exports = function(grunt) {
// Configuration
grunt.initConfig({
'dart-sass': {
target: {
options: {
sourceMap: false,
},
files: {
'src/static/css/mycryptocheckout.css': 'src/static/css/scss/mycryptocheckout.scss',
}
}
},
postcss: {
options: {
processors: [
require('autoprefixer')({
overrideBrowserslist: ['> 0.5%, last 2 versions, Firefox ESR, not dead']
})
]
},
dist: {
src: 'src/static/css/mycryptocheckout.css'
}
},
copy: {
main: {
files: [
// copies web3.js file
{
expand: true,
flatten: true,
src: ['node_modules/web3/dist/web3.min.js'],
dest: 'src/static/js/',
filter: 'isFile'
},
// copies bignumber.js file
{
expand: true,
flatten: true,
src: ['node_modules/bignumber.js/bignumber.js'],
dest: 'src/static/js/js.d/',
filter: 'isFile',
// Rename the file to include '40.' prefix
rename: function (dest, matchedSrcPath) {
if (matchedSrcPath.substring(0, 1) !== '4') {
return dest + '10.' + matchedSrcPath;
}
}
},
// copies clipboard.js file
{
expand: true,
flatten: true,
src: ['node_modules/clipboard/dist/clipboard.js'],
dest: 'src/static/js/js.d/',
filter: 'isFile',
// Rename the file to include '40.' prefix
rename: function (dest, matchedSrcPath) {
if (matchedSrcPath.substring(0, 1) !== '4') {
return dest + '40.' + matchedSrcPath;
}
}
},
// copies qrcode.js file
{
expand: true,
flatten: true,
src: ['node_modules/qrcode/build/qrcode.js'],
dest: 'src/static/js/js.d/',
filter: 'isFile',
// Rename the file to include '40.' prefix
rename: function (dest, matchedSrcPath) {
if (matchedSrcPath.substring(0, 1) !== '4') {
return dest + '40.' + matchedSrcPath;
}
}
},
],
},
},
concat: {
basic_and_extras: {
files: {
'src/static/js/mycryptocheckout.js':
[
'src/static/js/js.d/10.bignumber.js',
'src/static/js/js.d/10.mcc_make_clipboard.js',
'src/static/js/js.d/10.new_currency.js',
'src/static/js/js.d/10.plainview_auto_tabs.js',
'src/static/js/js.d/10.sort_wallets.js',
'src/static/js/js.d/20.header.js',
'src/static/js/js.d/40.clipboard.js',
'src/static/js/js.d/40.qrcode.js',
'src/static/js/js.d/50.checkout.js',
'src/static/js/js.d/50.donations.js',
'src/static/js/js.d/98.init.js',
'src/static/js/js.d/99.footer.js',
],
},
},
},
uglify: {
options: {
mangle: false,
},
my_target: {
files: {
'src/static/js/mycryptocheckout.min.js': ['src/static/js/mycryptocheckout.js'],
}
}
},
});
// Load plugins
grunt.loadNpmTasks('grunt-dart-sass');
grunt.loadNpmTasks('@lodder/grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
// Run All Tasks
grunt.registerTask('all', ['dart-sass', 'postcss', 'copy', 'concat', 'uglify']);
};