This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGruntfile.js
73 lines (69 loc) · 2.3 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
module.exports = function(grunt) {
// Concatenation file order
var concatFiles = ['node_modules/mithril.bindings/dist/mithril.bindings.js', 'src/mithril.animate.js', 'src/mithril.animate.bindings.js'];
concatNobindFiles = ['src/mithril.animate.js'];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
// We'd prefer to fail on missing files, but at least this will warn: https://github.com/gruntjs/grunt-contrib-concat/issues/15
nonull: true,
files: {
'dist/version/<%= pkg.name %>-<%= pkg.version %>.js': concatFiles,
'dist/<%= pkg.name %>.js': concatFiles,
'dist/version/<%= pkg.name %>-<%= pkg.version %>.nobind.js': concatNobindFiles,
'dist/nobind/<%= pkg.name %>.nobind.js': concatNobindFiles
}
}
},
qunit: {
files: ['test/**/*.htm']
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
files: {
'dist/version/<%= pkg.name %>-<%= pkg.version %>.min.js': 'dist/version/<%= pkg.name %>-<%= pkg.version %>.js',
'dist/<%= pkg.name %>.min.js': 'dist/<%= pkg.name %>.js',
'dist/version/<%= pkg.name %>-<%= pkg.version %>.nobind.min.js': 'dist/version/<%= pkg.name %>-<%= pkg.version %>.nobind.js',
'dist/nobind/<%= pkg.name %>.nobind.min.js': 'dist/nobind/<%= pkg.name %>.nobind.js'
}
}
},
jshint: {
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
options: {
ignores: [],
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true
},
// Ignore specific errors
'-W015': true, // Indentation of }
'-W099': true, // Mixed spaces and tabs
'-W032': true // Unnecessary semicolon
}
},
watch: {
files: ['<%= jshint.files %>'],
// Just build when watching
tasks: ['concat']
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('test', ['jshint', 'qunit']);
grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);
grunt.registerTask('justbuild', ['concat', 'uglify']);
};