forked from evoluteur/colorpicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
108 lines (91 loc) · 3.75 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
/*
_ _ _
___ ___ | | ___ _ __ _ __ (_) ___| | _____ _ __
/ __/ _ \| |/ _ \| '__| '_ \| |/ __| |/ / _ \ '__|
| (_| (_) | | (_) | | | |_) | | (__| < __/ |
\___\___/|_|\___/|_| | .__/|_|\___|_|\_\___|_|
|_|
*/
module.exports = function (grunt) {
grunt.initConfig({
// *************************************************************************************
// CONFIG OPTIONS
// *************************************************************************************
pkg: grunt.file.readJSON('package.json'),
banner : '/*\n <%= pkg.name %> <%= pkg.version %>\n <%= pkg.copyright %>\n <%= pkg.homepage %>\n*/\n',
// *************************************************************************************
// JSHINT options
// *************************************************************************************
jshint: {
all: [
'Gruntfile.js',
'package.json',
'js/evol-colorpicker.js'
]
},
// *************************************************************************************
// UGLIFY options
// *************************************************************************************
uglify: {
options: {
banner: '<%= banner %>',
mangle: true
},
js: {
files: {
'js/evol-colorpicker.min.js': ['js/evol-colorpicker.js']
}
}
},
// *************************************************************************************
// LESS
// *************************************************************************************
less: {
dev: {
options: {
banner: '<%= banner %>'
},
files: {
"css/evol-colorpicker.css": "less/evol-colorpicker.less",
"css/demo.css": "less/demo.less"
}
},
prod: {
options: {
banner: '<%= banner %>',
compress: true
},
files: {
"css/evol-colorpicker.min.css": "less/evol-colorpicker.less"
}
}
}
});
// Load the plugin that provides the tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
// Custom tasks
grunt.registerTask('header', 'evol-colorpicker version', function(arg1) {
var pkg=grunt.file.readJSON('package.json');
console.log(
(new Date()).toString() + '\n' +
' _ _ _\n'+
' ___ ___ | | ___ _ __ _ __ (_) ___| | _____ _ __\n'+
' / __/ _ \\| |/ _ \\| \'__| \'_ \\| |/ __| |/ / _ \\ \'__|\n'+
' | (_| (_) | | (_) | | | |_) | | (__| < __/ |\n'+
' \\___\\___/|_|\\___/|_| | .__/|_|\\___|_|\\_\\___|_| \n'+
' |_| '+
arg1 + ' '+ pkg.version
);
});
// *************************************************************************************
// BUILD TASKS : dev prod
// *************************************************************************************
// Default task(s).
grunt.registerTask('default', ['prod']);
// Dev only task(s).
grunt.registerTask('dev', ['header:dev', 'jshint', 'less:dev']);
// Prod task(s).
grunt.registerTask('prod', ['header:prod', 'jshint', 'uglify', 'less']);
};