$ar = array_merge($ar , glob($dir . '/'. $f));
continue;
}
-
+ if (!preg_match('/\.js$/', $f)) {
+ $f .= ".js";
+ }
$ar[] = $dir .'/'. $f;
}
$mtime = 0;
foreach($ar as $fn) {
$f = basename($fn);
- if (!preg_match('/\.js$/', $f)) { // only javascript files... (so XXX.Dialog.YYY* works..)
+ if (!preg_match('/\.js$/', $f) || $fn == '.js' || !file_exists($dir . '/' . $f)) { // only javascript files... (so XXX.Dialog.YYY* works..)
continue;
}
// got the 'module file..'
ksort($arfiles); // just sort by name so it's consistant for serialize..
- $ui = posix_getpwuid(posix_geteuid());
-
-
- $compiledir = session_save_path() . '/' .
- $ui['name'] . '-' . $ff->project . '-' . $ff->version . '-jscompile';
-
- if (!file_exists($compiledir)) {
- mkdir($compiledir,0700,true);
- }
+ require_once 'Pman/Core/Asset.php';
+ $compiledir = Pman_Core_Asset::getCompileDir('js', '', true);
break;
}
-
}
}
/**
* usage in template
- * {outputCssDir(#{Hydra/templates/images/css/#,#Hydra.js",#.......#)}
+ * {outputCSSDir(#{Hydra/templates/images/css/#,#Hydra.js",#.......#)}
*/
- function outputCssDir($path)
+ function outputCSSDir($path)
{
$relpath = $this->rootURL . '/' . $path .'/';
//print_r($relfiles);
+
+ require_once 'Pman/Core/Asset.php';
+ $compiledir = Pman_Core_Asset::getCompileDir('css', '', true);
- $ui = posix_getpwuid(posix_geteuid());
-
-
- $compiledir = session_save_path() . '/' .
- $ui['name'] . '-' . $ff->project . '-'. $ff->version . '-csscompile';
-
+
if (!file_exists($compiledir)) {
mkdir($compiledir,0700,true);
}
+ function outputSCSS($smod)
+ {
+ // we cant output non-cached versions of this....
+ $ff = HTML_FlexyFramework::get();
+ $fp = "{$this->rootDir}/Pman/$smod/scss/{$smod}.scss";
+ // var_dump($fp);
+ if (!file_exists($fp)) {
+ return;
+ }
+
+ $ar = glob(dirname($fp) . '/*.scss');
+ $maxtime = 0;
+ foreach($ar as $fn) {
+ $maxtime=max($maxtime, filemtime($fn));
+ }
+
+
+
+ //print_r($relfiles);
+
+ require_once 'Pman/Core/Asset.php';
+ $compiledir = Pman_Core_Asset::getCompileDir('css', '', true);
+
+
+ if (!file_exists($compiledir)) {
+ mkdir($compiledir,0700,true);
+ }
+
+
+
+
+ $output = date('Y-m-d-H-i-s-', $maxtime). $smod .'-'.md5(serialize(array($this->baseURL, $ar))) .'.css';
+
+ $asset = $ff->project == 'Pman' ? '/Core/Asset/css/' : '/Asset/css/';
+
+ // where are we going to write all of this..
+ // This has to be done via a
+
+
+
+ if ( !file_exists($compiledir.'/'.$output) || !filesize($compiledir.'/'.$output)) {
+
+
+
+ require_once 'System.php';
+ static $sassc = false;
+ if ($sassc === false) {
+ $sassc = System::which("sassc");
+ }
+ if (empty($sassc)) {
+ die("INSTALL sassc");
+ }
+
+ $fd = dirname($fp);
+
+ $ver = `$sassc --version`;
+ $bits = explode("\n", $ver);
+ foreach($bits as $b) {
+ $lr = explode(":", $b);
+ $vers[trim($lr[0])] = trim($lr[1]);
+ }
+
+ $sm = $vers['sass'] > 3.4 ? ' --sourcemap=auto ' : '--sourcemap';
+ $cmd = "{$sassc} --style=compressed {$sm} -I {$fd} -I {$this->rootDir}/roojs1/scss/bootstrap $smod.scss {$compiledir}/{$output}";
+ //echo "$cmd\n"; echo `$cmd`;
+ `$cmd`;
+
+
+ clearstatcache();
+ if (!file_exists($compiledir.'/'.$output) ||
+ !filesize($compiledir.'/'.$routput)) {
+ echo "<!-- compile did not generate files : $cmd -->\n";
+ echo "<script type=\"text/javascript\">alert('Failed to compile {$fp}');</script>\n";
+ return;
+ }
+
+ } else {
+ // echo "<!-- file already exists: {$basedir}/{$output} -->\n";
+ }
+
+
+ //$this->arrayToJsInclude( $files);
+ $this->assetArrayToHtml( array(
+ $this->baseURL.$asset. $output,
+
+ ),'css');
+
+ }
+
+
}
\ No newline at end of file