forked from leongersen/noUiSlider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
109 lines (98 loc) · 2.49 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
module.exports = function(grunt) {
var VERSION_TEMPLATE = '/*! <%= pkg.name %> - <%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd HH:MM:ss") %> */' +
'\n\n';
function getFiles ( ) {
return [
'src/js/intro.js',
'src/js/helpers.js',
'src/js/constants.js',
'src/js/range.js',
'src/js/options.js',
'src/js/scope_start.js',
'src/js/structure.js',
'src/js/tooltips.js',
'src/js/pips.js',
'src/js/scope_helpers.js',
'src/js/scope_events.js',
'src/js/scope.js',
'src/js/scope_end.js',
'src/js/interface.js',
'src/js/outro.js'
];
}
var releaseFiles = [
{ src: ['**/*'], dest: '', cwd: 'distribute/', expand: true },
{ src: ['**/*.css'], dest: '', cwd: 'src/', expand: true }
];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
banner: VERSION_TEMPLATE
},
basic: {
src: getFiles(),
dest: 'distribute/nouislider.js',
nonull: true
}
},
cssmin: {
all: {
options: {
banner: VERSION_TEMPLATE
},
files: {
'distribute/nouislider.min.css': ['src/nouislider.css', 'src/nouislider.pips.css', 'src/nouislider.tooltips.css']
}
}
},
jshint: {
options: {
browser: true,
indent: false,
laxbreak: true,
laxcomma: true,
validthis: true,
curly: true,
latedef: true,
undef: true,
unused: true,
globals: { module: true, define: true, __dirname: true, require: true }
},
basic: ['distribute/nouislider.js']
},
uglify: {
all: {
options: {
banner: VERSION_TEMPLATE
},
files: {
'distribute/nouislider.min.js': 'distribute/nouislider.js'
}
}
},
compress: {
all: {
options: {
archive: 'noUiSlider.<%= pkg.version %>.zip'
},
files: releaseFiles
}
}
});
// https://github.com/gruntjs/grunt-contrib-concat
grunt.loadNpmTasks('grunt-contrib-concat');
// https://github.com/gruntjs/grunt-contrib-uglify
grunt.loadNpmTasks('grunt-contrib-uglify');
// https://github.com/gruntjs/grunt-contrib-jshint
grunt.loadNpmTasks('grunt-contrib-jshint');
// https://github.com/gruntjs/grunt-contrib-cssmin
grunt.loadNpmTasks('grunt-contrib-cssmin');
// https://github.com/gruntjs/grunt-contrib-compress
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.registerTask('default', ['concat', 'jshint']);
grunt.registerTask('create', ['concat', 'uglify', 'cssmin']);
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('release', ['jshint', 'compress']);
};