forked from backbone-paginator/backbone.paginator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrunt.js
76 lines (72 loc) · 2.28 KB
/
grunt.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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("m/d/yyyy") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
concat: {
dist: {
src: ['<banner>', '<file_strip_banner:lib/<%= pkg.name %>.js>'],
dest: 'dist/<%= pkg.name %>.js'
}
},
min: {
dist: {
src: ['<banner>', '<config:concat.dist.dest>'],
dest: 'dist/<%= pkg.name %>.min.js'
}
},
mocha: {
all: [ 'test/test.html' ]
},
lint: {
files: ['grunt.js', 'lib/**/*.js', 'test/backbone.paginator*.js']
},
watch: {
files: '<config:lint.files>',
tasks: 'lint'
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
// unfortunately JSHint can't enforce the indentation without also enforcing
// Crockford's styleguide. see https://github.com/jshint/jshint/issues/655
// This is already fixed in master: https://github.com/jshint/jshint/issues/667
// As soon as it is released the following line can be uncommented
//indent: 2,
trailing: true
},
globals: {
exports: true,
module: false
}
},
uglify: {}
});
// Default task.
grunt.registerTask('default', 'lint mocha concat replace-version min');
grunt.registerTask('test', 'lint mocha');
// run `npm install grunt-mocha` in project root dir and uncomment this
grunt.loadNpmTasks('grunt-mocha');
grunt.registerTask('replace-version', 'replace the version placeholder in backbone.paginator.js', function() {
var pkg = grunt.config.get('pkg');
var filename = 'dist/' + pkg.name + '.js';
var content = grunt.file.read(filename);
var rendered = grunt.template.process(content, { pkg : pkg });
grunt.file.write(filename, rendered);
});
};