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

107 lines
3.2 KiB
JavaScript
Raw Normal View History

2014-02-19 09:15:05 -05:00
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
buildName: 'matter',
2014-03-10 21:17:41 -04:00
docVersion: 'v<%= pkg.version %>',
2014-02-19 09:15:05 -05:00
concat: {
build: {
options: {
process: function(src, filepath) {
return '// Begin ' + filepath + '\n\n' + src + '\n\n; // End ' + filepath + '\n\n';
}
},
src: ['src/**/*.js', '!src/module/*'],
dest: 'build/<%= buildName %>.js'
2014-02-19 09:15:05 -05:00
},
pack: {
options: {
banner: '/**\n* <%= buildName %>.js <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n',
2014-02-19 09:15:05 -05:00
},
src: ['src/module/Intro.js', 'build/<%= buildName %>.js', 'src/module/Outro.js'],
dest: 'build/<%= buildName %>.js'
2014-02-19 09:15:05 -05:00
}
},
uglify: {
options: {
banner: '/**\n* <%= buildName %>.min.js <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n',
2014-02-19 09:15:05 -05:00
},
build: {
src: 'build/<%= buildName %>.js',
dest: 'build/<%= buildName %>.min.js'
2014-02-19 09:15:05 -05:00
}
},
copy: {
demo: {
src: 'build/<%= buildName %>.js',
dest: 'demo/js/lib/<%= buildName %>.js'
2014-02-19 09:15:05 -05:00
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: ['src/**/*.js', '!src/module/*']
},
connect: {
watch: {
options: {
port: 9000,
open: 'http://localhost:9000/demo/dev.html',
2014-02-19 09:15:05 -05:00
livereload: 9001
}
}
},
watch: {
options: {
livereload: {
port: 9001
}
},
src: {
files: ['src/**/*.js'],
tasks: ['set_config:buildName:matter-dev','build']
2014-02-19 09:15:05 -05:00
},
demo: {
files: ['build/matter.js', 'demo/js/**/*.html', 'demo/js/**/*.js', 'demo/css/**/*.css']
}
},
2014-02-28 13:23:25 -05:00
yuidoc: {
compile: {
2014-03-10 21:17:41 -04:00
name: '<%= pkg.name %>.js Physics Engine API Documentation for <%= docVersion %>',
2014-02-28 13:23:25 -05:00
description: '<%= pkg.description %>',
2014-03-10 21:17:41 -04:00
version: '<%= docVersion %>',
2014-02-28 13:23:25 -05:00
url: '<%= pkg.homepage %>',
options: {
paths: 'src',
themedir: 'matter-doc-theme',
outdir: 'doc',
linkNatives: true
}
}
}
2014-02-19 09:15:05 -05:00
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-copy');
2014-02-28 13:23:25 -05:00
grunt.loadNpmTasks('grunt-contrib-yuidoc');
2014-02-19 09:15:05 -05:00
grunt.registerTask('default', ['test', 'build']);
grunt.registerTask('build', ['concat', 'uglify', 'copy']);
2014-02-19 09:15:05 -05:00
grunt.registerTask('test', ['jshint']);
grunt.registerTask('dev', ['set_config:buildName:matter-dev', 'build', 'connect:watch', 'watch']);
2014-03-10 21:17:41 -04:00
grunt.registerTask('doc', function(n) {
var dev = grunt.option('dev');
if (dev)
grunt.config.set('docVersion', 'edge version (master)');
grunt.task.run('yuidoc');
});
grunt.registerTask('set_config', 'Set a config property.', function(name, val) {
grunt.config.set(name, val);
});
2014-02-19 09:15:05 -05:00
};