Converted to grunt build

This commit is contained in:
Charlotte Gore 2013-04-03 13:17:42 +01:00
parent 8a2051c8a2
commit 32aa6fea38
7 changed files with 143 additions and 38 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
node_modules

115
Gruntfile.js Normal file
View file

@ -0,0 +1,115 @@
module.exports = function(grunt){
"use strict";
var root = "src/pixi/",
debug = "bin/pixi.dev.js",
build = "bin/pixi.js";
grunt.initConfig({
pkg : grunt.file.readJSON("package.json"),
build : {
all : {
dest : debug,
src : [
"Pixi.js",
"Point.js",
"Rectangle.js",
"DisplayObject.js",
"DisplayObjectContainer.js",
"Sprite.js",
"MovieClip.js",
"InteractionManager.js",
"Stage.js",
"utils/Utils.js",
"utils/EventTarget.js",
"utils/Matrix.js",
"utils/Detector.js",
"renderers/WebGLShaders.js",
"renderers/WebGLRenderer.js",
"renderers/WebGLBatch.js",
"renderers/CanvasRenderer.js",
"extras/Strip.js",
"extras/Rope.js",
"textures/BaseTexture.js",
"textures/Texture.js",
"loaders/SpriteSheetLoader.js",
"loaders/AssetLoader.js"
]
}
},
jshint : {
dist : {
src : [debug],
options : {
asi : true,
smarttabs: true
}
}
},
uglify : {
all : {
files : {
"bin/pixi.js" : [ debug ]
}
}
},
distribute : {
examples : [
"examples/example 1 - Basics",
"examples/example 2 - SpriteSheet",
"examples/example 3 - MovieClip",
"examples/example 4 - Balls",
"examples/example 5 - Morph",
"examples/example 6 - Interactivity",
]
}
});
grunt.registerMultiTask(
"build",
"Contatenate source",
function(){
var compiled = "",
name = this.data.dest,
src = this.data.src;
src.forEach(function(filepath){
compiled += grunt.file.read( root + filepath );
});
grunt.file.write(name, compiled);
grunt.log.writeln("File '" + name + "' created.");
}
)
grunt.registerMultiTask(
"distribute",
"Copy built file to examples",
function(){
var pixi = grunt.file.read( debug );
var dests = this.data;
dests.forEach(function(filepath){
grunt.file.write(filepath + "/pixi.js", pixi);
});
grunt.log.writeln("Pixi copied to examples.");
}
)
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify");
//grunt.registerTask("default", ["build:*:*", "jshint", "uglify"]);
grunt.registerTask("default", ["build:*:*", "uglify", "distribute:*:*"])
}

View file

@ -39,12 +39,27 @@ last 2 examples and allowing us to share the source code :)
### How to build ###
PixiJS is build with Grunt. If you don't already have this, go install Node and NPM then install the Grunt Command Line.
```
cd build
ant -f PixiBuild.xml
$> npm install -g grunt-cli
```
This will create a minified version at bin/pixi.js and a non-minified version at bin/pixi.dev.js
Then, in the folder where you have downloaded the source, install the build dependencies using npm:
```
$> npm install
```
Then build:
```
$> grunt
```
This will create a minified version at bin/pixi.js and a non-minified version at bin/pixi.dev.js.
It also copies the non-minified version to the examples.
### Current features ###

View file

@ -1,35 +0,0 @@
<?xml version="1.0"?>
<project basedir="." default="run">
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="${basedir}/compiler.jar"/>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${basedir}/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<target name="run">
<concat destfile="../bin/pixi.dev.js">
<filelist dir="../src/pixi" files="Pixi.js, Point.js, Rectangle.js, DisplayObject.js, DisplayObjectContainer.js"/>
<filelist dir="../src/pixi" files="Sprite.js, MovieClip.js, InteractionManager.js, Stage.js"/>
<filelist dir="../src/pixi/utils" files="Utils.js, EventTarget.js, Matrix.js, Detector.js"/>
<filelist dir="../src/pixi/renderers" files="WebGLShaders.js, WebGLRenderer.js, WebGLBatch.js, CanvasRenderer.js"/>
<filelist dir="../src/pixi/extras" files="Strip.js, Rope.js"/>
<filelist dir="../src/pixi/textures" files="BaseTexture.js, Texture.js"/>
<filelist dir="../src/pixi/loaders" files="SpriteSheetLoader.js, AssetLoader.js"/>
</concat>
<jscomp compilationLevel="simple" debug="false" output="../bin/pixi.js">
<sources dir="../bin/">
<file name="pixi.dev.js"/>
</sources>
</jscomp>
</target>
</project>

Binary file not shown.

Binary file not shown.

9
package.json Normal file
View file

@ -0,0 +1,9 @@
{
"name" : "Pixi.JS",
"version" : "0.0.1",
"devDependencies" : {
"grunt" : "~0.4.x",
"grunt-contrib-jshint" : "~0.1.1",
"grunt-contrib-uglify" : "~0.2.0"
}
}