summaryrefslogtreecommitdiff
path: root/buildscripts/jsbuilder/build.php
diff options
context:
space:
mode:
authorwei <>2006-04-30 00:15:23 +0000
committerwei <>2006-04-30 00:15:23 +0000
commit10b65d6d03ee0afc1ec1a50f320af42a79f5492b (patch)
treed6b8167e0d224f21db6a16da251ba4d069468543 /buildscripts/jsbuilder/build.php
parent2cc93773feb5e76d2dd002b1dcd463a01d606794 (diff)
Adding Callback foundations.
Diffstat (limited to 'buildscripts/jsbuilder/build.php')
-rw-r--r--buildscripts/jsbuilder/build.php28
1 files changed, 12 insertions, 16 deletions
diff --git a/buildscripts/jsbuilder/build.php b/buildscripts/jsbuilder/build.php
index cc41c963..7070f67f 100644
--- a/buildscripts/jsbuilder/build.php
+++ b/buildscripts/jsbuilder/build.php
@@ -45,6 +45,8 @@ if(SOURCE_DIR===false || TARGET_DIR===false)
if(!is_writable(TARGET_DIR))
die('Unable to create files under '.TARGET_DIR.'.');
+include(dirname(__FILE__).'/jsmin.php');
+
/**
* list of js library files to be compressed and built
*/
@@ -98,12 +100,12 @@ $libraries = array(
//active controls
'ajax.js' => array(
'prototype/ajax.js',
- 'prado/ajax.js',
- 'extra/json.js',
- 'effects/controls.js',
+ 'prado/ajax3.js',
+ 'extra/json.js'
+/* 'effects/controls.js',
'effects/dragdrop.js',
'effects/slider.js',
- 'prado/activecontrols.js'
+ 'prado/activecontrols.js'*/
),
//logging
'logger.js' => array(
@@ -161,8 +163,12 @@ foreach($libraries as $libFile => $sourceFiles)
echo "...adding $sourceFile\n";
$contents.=file_get_contents($sourceFile)."\n\n";
}
-
- file_put_contents($libFile,compress_js($contents));
+ $tempFile=$libFile.'.tmp';
+ file_put_contents($tempFile,$contents);
+ $jsMin = new JSMin($tempFile, $libFile);
+ $jsMin -> minify();
+ unset($jsMin);
+ @unlink($tempFile);
echo "Saving file {$libFile}\n";
$builds++;
}
@@ -182,14 +188,4 @@ else if($builds > 0)
else
echo "No files to build.";
-//remove comments from javascript files.
-function compress_js($string)
-{
- $string = preg_replace('/\/\/[^\n\r]*[\n\r]/', ' ', $string);
- $string = preg_replace('/\/\*[^*]*\*+([^\/][^*]*\*+)*\//', ' ', $string);
- $string = preg_replace('/ |\t|\r/', '', $string);
- $string = preg_replace('/(\n[ \t]*){2,}/', "\n", $string);
- return $string;
-}
-
?> \ No newline at end of file