mirror of
https://github.com/wassname/phaser.git
synced 2026-08-11 11:23:06 +08:00
* Removed the callbackContext parameter from Group.callAll because it's no longer needed.
* Updated Group.forEach, forEachAlive and forEachDead so you can now pass as many parameters as you want, which will all be given to the callback after the child. * Updated build script so it can be run from the command-line and includes UMD wrappers (thanks iaincarsberg)
This commit is contained in:
+38
-13
@@ -1,15 +1,14 @@
|
||||
<a href="http://yui.2clics.net/">Minify it</a><br />
|
||||
|
||||
<textarea style="width: 800px; height: 800px">
|
||||
<?php
|
||||
date_default_timezone_set('Europe/London');
|
||||
|
||||
// Get the version number
|
||||
// VERSION: '1.0.5',
|
||||
$vf = file_get_contents('../src/Phaser.js');
|
||||
$vf = file_get_contents(dirname(__FILE__) . '/../src/Phaser.js');
|
||||
$version = substr($vf, strpos($vf, 'VERSION: ') + 10, 5);
|
||||
$buildLog = "Building version $version \n\n";
|
||||
$header = "";
|
||||
|
||||
echo "Building version $version \n\n";
|
||||
|
||||
$js = file('../examples/js.php');
|
||||
$js = file(dirname(__FILE__) . '/../examples/js.php');
|
||||
$output = "";
|
||||
|
||||
for ($i = 0; $i < count($js); $i++)
|
||||
@@ -20,10 +19,10 @@
|
||||
if (strpos($line, '<script') !== false)
|
||||
{
|
||||
$line = str_replace('<script src="', '', $line);
|
||||
$line = str_replace('"></script>', '', $line);
|
||||
$line = dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace('"></script>', '', $line);
|
||||
$filename = substr($line, strrpos($line, '/') + 1);
|
||||
|
||||
echo $line . "\n";
|
||||
$buildLog .= $line . "\n";
|
||||
// echo $filename . "\n";
|
||||
|
||||
// Read the file in
|
||||
@@ -36,15 +35,41 @@
|
||||
|
||||
// {version}
|
||||
$source = str_replace('{version}', $version, $source);
|
||||
}
|
||||
|
||||
$output .= $source . "\n";
|
||||
// Set the header
|
||||
$header = $source;
|
||||
|
||||
} else {
|
||||
$output .= $source . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//echo $output;
|
||||
// Create a UMD wrapper, to allow Phaser to be exposed to AMD, Node and Browsers
|
||||
$template = <<<EOT
|
||||
%s(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory();
|
||||
} else {
|
||||
root.Phaser = factory();
|
||||
}
|
||||
}(this, function (b) {
|
||||
%s
|
||||
return Phaser;
|
||||
}));
|
||||
EOT;
|
||||
|
||||
file_put_contents('phaser.js', $output);
|
||||
file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'phaser.js', sprintf($template, $header, $output));
|
||||
|
||||
if(php_sapi_name() == 'cli' || empty($_SERVER['REMOTE_ADDR'])) {
|
||||
echo "\ndone\n\n";
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<a href="http://yui.2clics.net/">Minify it</a><br />
|
||||
|
||||
<textarea style="width: 800px; height: 800px">
|
||||
<?php echo $buildLog; ?>
|
||||
</textarea>
|
||||
Reference in New Issue
Block a user