This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
/
Gruntfile.js
108 lines (98 loc) · 3.2 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
/*global module:false*/
var childProc = require("child_process");
module.exports = function(grunt) {
var pkg;
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: pkg = grunt.file.readJSON('package.json'),
scriptname: 'overthrow',
banner: '/*! <%= pkg.title || scriptname %> - <%= pkg.description %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>; Licensed <%= pkg.license %> */\n',
// Task configuration.
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
main: {
src: ['src/overthrow-detect.js','src/overthrow-toss.js','src/overthrow-polyfill.js','src/overthrow-init.js'],
dest: 'dist/<%= scriptname %>.js'
},
sidescroller: {
src: ['src/overthrow-detect.js','src/overthrow-toss.js','src/overthrow-polyfill.js','src/overthrow-init.js','extensions/overthrow-sidescroller.js'],
dest: 'dist/<%= scriptname %>.sidescroller.js'
}
},
qunit: {
files: ['test/*.html']
},
uglify: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
main: {
src: ['src/overthrow-detect.js','src/overthrow-toss.js','src/overthrow-polyfill.js','src/overthrow-init.js'],
dest: 'dist/<%= scriptname %>.min.js'
},
sidescroller: {
src: ['src/overthrow-detect.js','src/overthrow-toss.js','src/overthrow-polyfill.js','src/overthrow-init.js','extensions/overthrow-sidescroller.js'],
dest: 'dist/<%= scriptname %>.sidescroller.min.js'
},
sidescrollerExtensions: {
files: (function() {
var files = {};
["append", "disable-nav", "goto", "skip"].forEach(function( plugin ) {
files[ "dist/overthrow-sidescroller." + plugin + ".min.js" ] =
[ "dist/overthrow-sidescroller." + plugin + ".js" ];
});
return files;
})()
}
},
copy: {
plugins: {
files: [
{
expand: true,
// NOTE prevent overwritting by only pulling namespaced files
src: "extensions/*sidescroller.*.js",
dest: "dist/",
filter: "isFile",
flatten: true
}
]
},
toss: {
files: [
{
expand: true,
// NOTE prevent overwritting by only pulling namespaced files
src: "lib/toss/toss.js",
dest: "lib/toss/",
filter: "isFile",
flatten: true
},
]
},
}
});
// because the compress plugin is insane
grunt.task.registerTask( "compress", "compress the dist folder", function() {
var done = this.async();
childProc.exec( "tar czf dist-" + pkg.version + ".tar.gz dist", function() {
done();
});
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task.
grunt.registerTask('default', ['copy', 'concat', 'uglify']);
grunt.registerTask('stage', ['copy', 'concat', 'uglify']);
grunt.registerTask('travis', ['qunit']);
};