0 | 0 |
'use strict';
|
1 | 1 |
|
2 | 2 |
module.exports = function(grunt) {
|
|
3 |
// Project configuration.
|
|
4 |
grunt.initConfig({
|
|
5 |
// Metadata.
|
|
6 |
pkg: grunt.file.readJSON('package.json'),
|
3 | 7 |
|
4 | |
// Project configuration.
|
5 | |
grunt.initConfig({
|
6 | |
// Metadata.
|
7 | |
pkg: grunt.file.readJSON('package.json'),
|
|
8 |
banner:
|
|
9 |
'/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
|
|
10 |
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
|
|
11 |
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
|
|
12 |
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
|
13 |
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
|
|
14 |
// Task configuration.
|
|
15 |
clean: {
|
|
16 |
files: ['dist']
|
|
17 |
},
|
|
18 |
concat: {
|
|
19 |
options: {
|
|
20 |
banner: '<%= banner %>',
|
|
21 |
stripBanners: true
|
|
22 |
},
|
|
23 |
dist: {
|
|
24 |
src: ['src/<%= pkg.filename %>.js'],
|
|
25 |
dest: 'dist/<%= pkg.filename %>.js'
|
|
26 |
}
|
|
27 |
},
|
|
28 |
uglify: {
|
|
29 |
options: {
|
|
30 |
banner: '<%= banner %>'
|
|
31 |
},
|
|
32 |
dist: {
|
|
33 |
src: '<%= concat.dist.dest %>',
|
|
34 |
dest: 'dist/<%= pkg.filename %>.min.js'
|
|
35 |
}
|
|
36 |
},
|
|
37 |
qunit: {
|
|
38 |
all: {
|
|
39 |
options: {
|
|
40 |
urls: [
|
|
41 |
'1.7.2',
|
|
42 |
'1.8.3',
|
|
43 |
'1.9.1',
|
|
44 |
'1.10.2',
|
|
45 |
'1.11.2',
|
|
46 |
'2.0.3',
|
|
47 |
'2.1.3',
|
|
48 |
'3.0.0',
|
|
49 |
'3.1.0',
|
|
50 |
'3.2.1'
|
|
51 |
].map(function(version) {
|
|
52 |
return (
|
|
53 |
'http://localhost:<%= connect.server.options.port %>/test/slugify.html?jquery=' +
|
|
54 |
version
|
|
55 |
);
|
|
56 |
})
|
|
57 |
}
|
|
58 |
}
|
|
59 |
},
|
|
60 |
jshint: {
|
|
61 |
gruntfile: {
|
|
62 |
options: {
|
|
63 |
jshintrc: '.jshintrc'
|
|
64 |
},
|
|
65 |
src: 'Gruntfile.js'
|
|
66 |
},
|
|
67 |
src: {
|
|
68 |
options: {
|
|
69 |
jshintrc: 'src/.jshintrc'
|
|
70 |
},
|
|
71 |
src: ['src/**/*.js']
|
|
72 |
},
|
|
73 |
test: {
|
|
74 |
options: {
|
|
75 |
jshintrc: 'test/.jshintrc'
|
|
76 |
},
|
|
77 |
src: ['test/**/*.js']
|
|
78 |
}
|
|
79 |
},
|
|
80 |
watch: {
|
|
81 |
gruntfile: {
|
|
82 |
files: '<%= jshint.gruntfile.src %>',
|
|
83 |
tasks: ['jshint:gruntfile']
|
|
84 |
},
|
|
85 |
src: {
|
|
86 |
files: '<%= jshint.src.src %>',
|
|
87 |
tasks: ['jshint:src', 'qunit']
|
|
88 |
},
|
|
89 |
test: {
|
|
90 |
files: '<%= jshint.test.src %>',
|
|
91 |
tasks: ['jshint:test', 'qunit']
|
|
92 |
}
|
|
93 |
},
|
|
94 |
connect: {
|
|
95 |
server: {
|
|
96 |
options: {
|
|
97 |
port: 4321,
|
|
98 |
hostname: 'localhost'
|
|
99 |
}
|
|
100 |
}
|
|
101 |
}
|
|
102 |
});
|
8 | 103 |
|
9 | |
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
|
10 | |
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
|
11 | |
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
|
12 | |
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
13 | |
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
|
14 | |
// Task configuration.
|
15 | |
clean: {
|
16 | |
files: ['dist']
|
17 | |
},
|
18 | |
concat: {
|
19 | |
options: {
|
20 | |
banner: '<%= banner %>',
|
21 | |
stripBanners: true
|
22 | |
},
|
23 | |
dist: {
|
24 | |
src: ['src/<%= pkg.filename %>.js'],
|
25 | |
dest: 'dist/<%= pkg.filename %>.js'
|
26 | |
}
|
27 | |
},
|
28 | |
uglify: {
|
29 | |
options: {
|
30 | |
banner: '<%= banner %>'
|
31 | |
},
|
32 | |
dist: {
|
33 | |
src: '<%= concat.dist.dest %>',
|
34 | |
dest: 'dist/<%= pkg.filename %>.min.js'
|
35 | |
}
|
36 | |
},
|
37 | |
qunit: {
|
38 | |
all: {
|
39 | |
options: {
|
40 | |
urls: ['1.7.2','1.8.3','1.9.1','1.10.2','1.11.2','2.0.3', '2.1.3'].map(function(version) {
|
41 | |
return 'http://localhost:<%= connect.server.options.port %>/test/slugify.html?jquery=' + version;
|
42 | |
})
|
43 | |
}
|
44 | |
}
|
45 | |
},
|
46 | |
jshint: {
|
47 | |
gruntfile: {
|
48 | |
options: {
|
49 | |
jshintrc: '.jshintrc'
|
50 | |
},
|
51 | |
src: 'Gruntfile.js'
|
52 | |
},
|
53 | |
src: {
|
54 | |
options: {
|
55 | |
jshintrc: 'src/.jshintrc'
|
56 | |
},
|
57 | |
src: ['src/**/*.js']
|
58 | |
},
|
59 | |
test: {
|
60 | |
options: {
|
61 | |
jshintrc: 'test/.jshintrc'
|
62 | |
},
|
63 | |
src: ['test/**/*.js']
|
64 | |
}
|
65 | |
},
|
66 | |
watch: {
|
67 | |
gruntfile: {
|
68 | |
files: '<%= jshint.gruntfile.src %>',
|
69 | |
tasks: ['jshint:gruntfile']
|
70 | |
},
|
71 | |
src: {
|
72 | |
files: '<%= jshint.src.src %>',
|
73 | |
tasks: ['jshint:src', 'qunit']
|
74 | |
},
|
75 | |
test: {
|
76 | |
files: '<%= jshint.test.src %>',
|
77 | |
tasks: ['jshint:test', 'qunit']
|
78 | |
}
|
79 | |
},
|
80 | |
connect: {
|
81 | |
server: {
|
82 | |
options: {
|
83 | |
port: 4321,
|
84 | |
hostname: 'localhost'
|
85 | |
}
|
86 | |
}
|
87 | |
}
|
88 | |
});
|
|
104 |
// These plugins provide necessary tasks.
|
|
105 |
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
106 |
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
107 |
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
108 |
grunt.loadNpmTasks('grunt-contrib-qunit');
|
|
109 |
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
110 |
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
111 |
grunt.loadNpmTasks('grunt-contrib-connect');
|
89 | 112 |
|
90 | |
// These plugins provide necessary tasks.
|
91 | |
grunt.loadNpmTasks('grunt-contrib-clean');
|
92 | |
grunt.loadNpmTasks('grunt-contrib-concat');
|
93 | |
grunt.loadNpmTasks('grunt-contrib-uglify');
|
94 | |
grunt.loadNpmTasks('grunt-contrib-qunit');
|
95 | |
grunt.loadNpmTasks('grunt-contrib-jshint');
|
96 | |
grunt.loadNpmTasks('grunt-contrib-watch');
|
97 | |
grunt.loadNpmTasks('grunt-contrib-connect');
|
98 | |
|
99 | |
// Default task.
|
100 | |
grunt.registerTask('default', ['connect', 'jshint', 'qunit', 'clean', 'concat', 'uglify']);
|
101 | |
// Test task
|
102 | |
grunt.registerTask('test', ['connect', 'jshint', 'qunit']);
|
|
113 |
// Default task.
|
|
114 |
grunt.registerTask('default', [
|
|
115 |
'connect',
|
|
116 |
'jshint',
|
|
117 |
'qunit',
|
|
118 |
'clean',
|
|
119 |
'concat',
|
|
120 |
'uglify'
|
|
121 |
]);
|
|
122 |
// Test task
|
|
123 |
grunt.registerTask('test', ['connect', 'jshint', 'qunit']);
|
103 | 124 |
};
|