-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
127 lines (115 loc) · 3.44 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
module.exports = function (grunt) {
//dependencies
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
const gruntSettings = {
/* COMPILADOR LESS */
less: {
lessfiles: {
files: {
"build/cmp.css": "less/main.less"
},
ieCompat: false
}
},
/* POST CSS AUTO-PREFIXER CSS */
postcss: {
options: {
processors: [
require('autoprefixer')({
remove: false,
grid: true,
browsers: [
'last 4 Chrome versions',
'last 4 Firefox versions',
'last 4 Edge versions',
'last 4 iOS versions',
'last 4 Opera versions',
'last 4 Safari versions',
'last 4 OperaMobile versions',
'last 4 OperaMini versions',
'last 4 ChromeAndroid versions',
'last 4 FirefoxAndroid versions',
'last 4 ExplorerMobile versions'
]
})
]
},
lessfiles: {
src: 'build/cmp.css'
}
},
/* CSSMIN MINIFICA, COMBINA CSS */
cssmin: {
options: {
report: 'gzip'
},
lessfiles: {
files: {
'build/cmp.min.css': ['build/cmp.css']
}
}
},
/* COPY, COPIA ICONES */
copy: {
copyvendor: {
files: [{
expand: true,
cwd: 'icons',
src: ['**/*.svg'],
dest: 'build/icons/'
}]
}
},
/* BABEL */
babel: {
options: {
presets: ['@babel/preset-env']
},
dist: {
files: { 'build/cmp.js': 'js/script.js' }
}
},
/* UGLIFY MINIFICA */
uglify: {
options: {
compress: {
drop_debugger: false
}
},
jsfiles: {
files: [{
expand: true,
cwd: 'build',
src: ['cmp.js'],
dest: 'build',
ext: '.min.js',
extDot: 'last'
}]
}
},
/* WATCH, VERIFICA ALTERAÇÕES NOS ARQUIVOS */
watch: {
options: {
spawn: false,
interrupt: true
},
lessfiles: {
files: ['less/main.less'],
tasks: ['less:lessfiles', 'postcss:lessfiles', 'cssmin:lessfiles']
},
jsfiles: {
files: ['js/script.js'],
tasks: ['babel', 'uglify:jsfiles']
},
gruntfile: {
files: ['gruntfile.js']
}
}
};
grunt.initConfig(gruntSettings);
/* TAREFA PADRÃO */
grunt.registerTask('default', ['watch']);
/* TAREFA GERA TUDO */
grunt.registerTask('init', ['less', 'postcss', 'copy', 'cssmin', 'babel', 'uglify']);
};