0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-27 09:50:52 -05:00

added new build tasks for development build

This commit is contained in:
liabru 2014-03-07 16:58:57 +00:00
parent 4d678aae9c
commit 5e65166faa
5 changed files with 8499 additions and 13 deletions

View file

@ -1,6 +1,7 @@
module.exports = function(grunt) { module.exports = function(grunt) {
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
buildName: 'matter',
concat: { concat: {
build: { build: {
options: { options: {
@ -9,29 +10,29 @@ module.exports = function(grunt) {
} }
}, },
src: ['src/**/*.js', '!src/module/*'], src: ['src/**/*.js', '!src/module/*'],
dest: 'build/<%= pkg.name %>.js' dest: 'build/<%= buildName %>.js'
}, },
pack: { pack: {
options: { options: {
banner: '/**\n* <%= pkg.name %>.js <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n', banner: '/**\n* <%= buildName %>.js <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n',
}, },
src: ['src/module/Intro.js', 'build/<%= pkg.name %>.js', 'src/module/Outro.js'], src: ['src/module/Intro.js', 'build/<%= buildName %>.js', 'src/module/Outro.js'],
dest: 'build/<%= pkg.name %>.js' dest: 'build/<%= buildName %>.js'
} }
}, },
uglify: { uglify: {
options: { options: {
banner: '/**\n* <%= pkg.name %>.min.js <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n', banner: '/**\n* <%= buildName %>.min.js <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n',
}, },
build: { build: {
src: 'build/<%= pkg.name %>.js', src: 'build/<%= buildName %>.js',
dest: 'build/<%= pkg.name %>.min.js' dest: 'build/<%= buildName %>.min.js'
} }
}, },
copy: { copy: {
demo: { demo: {
src: 'build/<%= pkg.name %>.js', src: 'build/<%= buildName %>.js',
dest: 'demo/js/lib/<%= pkg.name %>.js' dest: 'demo/js/lib/<%= buildName %>.js'
} }
}, },
jshint: { jshint: {
@ -44,7 +45,7 @@ module.exports = function(grunt) {
watch: { watch: {
options: { options: {
port: 9000, port: 9000,
open: 'http://localhost:9000/demo', open: 'http://localhost:9000/demo/dev.html',
livereload: 9001 livereload: 9001
} }
} }
@ -57,7 +58,7 @@ module.exports = function(grunt) {
}, },
src: { src: {
files: ['src/**/*.js'], files: ['src/**/*.js'],
tasks: ['concat', 'uglify', 'copy'] tasks: ['set_config:buildName:matter-dev','build']
}, },
demo: { demo: {
files: ['build/matter.js', 'demo/js/**/*.html', 'demo/js/**/*.js', 'demo/css/**/*.css'] files: ['build/matter.js', 'demo/js/**/*.html', 'demo/js/**/*.js', 'demo/css/**/*.css']
@ -87,8 +88,13 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-yuidoc'); grunt.loadNpmTasks('grunt-contrib-yuidoc');
grunt.registerTask('default', ['test', 'concat', 'uglify', 'copy']); grunt.registerTask('default', ['test', 'build']);
grunt.registerTask('build', ['concat', 'uglify', 'copy']);
grunt.registerTask('test', ['jshint']); grunt.registerTask('test', ['jshint']);
grunt.registerTask('dev', ['connect:watch', 'watch']); grunt.registerTask('dev', ['set_config:buildName:matter-dev', 'build', 'connect:watch', 'watch']);
grunt.registerTask('doc', ['yuidoc']); grunt.registerTask('doc', ['yuidoc']);
grunt.registerTask('set_config', 'Set a config property.', function(name, val) {
grunt.config.set(name, val);
});
}; };

4213
build/matter-dev.js Normal file

File diff suppressed because it is too large Load diff

8
build/matter-dev.min.js vendored Normal file

File diff suppressed because one or more lines are too long

46
demo/dev.html Normal file
View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="robots" content="noindex">
<script type="text/javascript" src="./js/lib/dat.gui.min.js"></script>
<script type="text/javascript" src="./js/lib/resurrect.js"></script>
<script type="text/javascript" src="./js/lib/matter-dev.js"></script>
<script type="text/javascript" src="./js/Demo.js"></script>
<link rel="stylesheet" href="./css/style.css" type="text/css">
<title>Matter.js Demo (Dev. Build)</title>
</head>
<body>
<div class="container">
<h1>Matter.js Demo (Dev. Build)</h1>
<p><a href="./mobile.html">Mobile Demo</a> <span class="nav-sep">&middot;</span> <a href="http://brm.io/matter-js/">Project page</a> <span class="nav-sep">&middot;</span> <a href="https://github.com/liabru/matter-js">GitHub</a></p>
<div class="controls-container">
<select id="demo-select">
<option value="mixed">Mixed Shapes</option>
<option value="mixedSolid">Solid Rendering</option>
<option value="stack">Stack</option>
<option value="circleStack">Circle Stack</option>
<option value="pyramid">Pyramid</option>
<option value="car">Car</option>
<option value="newtonsCradle">Newton's Cradle</option>
<option value="restitution">Restitution</option>
<option value="friction">Friction</option>
<option value="airFriction">Air Friction</option>
<option value="gravity">Reverse Gravity</option>
<option value="sleeping">Sleeping</option>
<option value="broadphase">Grid Broadphase</option>
<option value="chains">Chains</option>
<option value="ballPool">Ball Pool</option>
<option value="wreckingBall">Wrecking Ball</option>
<option value="avalanche">Avalanche</option>
<option value="beachBalls">Beach Balls</option>
<option value="stress">Stress 1</option>
<option value="stress2">Stress 2</option>
</select>
<input id="demo-reset" value="Reset" type="submit">
</div>
<div id="canvas-container"></div>
</div>
</body>
</html>

4213
demo/js/lib/matter-dev.js Normal file

File diff suppressed because it is too large Load diff