X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=AssetTrait.php;fp=AssetTrait.php;h=38dee0ffbb575775efd31c661c6fc7905a601a61;hp=f653e561b13cc49e4105875fb9924f5d3313d8c9;hb=42135b770db0b6aa7e1149a9d48f5e10c6cb6144;hpb=5dc40059b11db1dc43844c022eca5644aae5520e diff --git a/AssetTrait.php b/AssetTrait.php index f653e561..38dee0ff 100644 --- a/AssetTrait.php +++ b/AssetTrait.php @@ -283,16 +283,41 @@ trait Pman_Core_AssetTrait { function outputSCSS($smod) { - // we cant output non-cached versions of this.... + // we cant output non-cached versions of this.... + + // this doesnt really look like it would work! + $this->outputCSSDir("{$this->rootDir}/Pman/{$smod}/scss/{$smod}.scss", $smod); + + } + /* + * Pman projects - expect + * /Pman/MyProject/scss/MyProject.less << + * this should contain includes for the others? + * @import "fonts.less"; + * .... + * Then all the files go here. + * /Pman/MyProject/scss/*.less + * + * For a Non Pman project + * send: + * /MyProject/scss/base.less << could be anything really... + * + * + */ + + + function outputSCSSDir($file, $smod= '') + { $ff = HTML_FlexyFramework::get(); - $fp = "{$this->rootDir}/Pman/$smod/scss/{$smod}.scss"; - // var_dump($fp); - if (!file_exists($fp)) { + $asset = $ff->project == 'Pman' ? '/Core/Asset/css/' : '/Asset/css/'; + + + if (!file_exists($file)) { return; } - $ar = glob(dirname($fp) . '/*.scss'); - $maxtime = 0; + $ar = glob(dirname($file). '/*.scss'); + $maxtime = filemtime($file); foreach($ar as $fn) { $maxtime=max($maxtime, filemtime($fn)); } @@ -309,17 +334,14 @@ trait Pman_Core_AssetTrait { mkdir($compiledir,0700,true); } - - - $output = date('Y-m-d-H-i-s-', $maxtime). $smod .'-'.md5(serialize(array($this->baseURL, $ar))) .'.css'; + $output = date('Y-m-d-H-i-s-', $maxtime). $smod .'-less-'.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)) { @@ -334,26 +356,26 @@ trait Pman_Core_AssetTrait { die("INSTALL sassc"); } - $fd = dirname($fp); - + $ver = `$sassc --version`; - $bits = explode("\n", $ver); + $bits = explode("\n", trim($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}"; + $cmd = "{$sassc} --style=compressed {$sm} -I ". dirname($file) . " -I {$this->rootDir}/roojs1/scss/bootstrap ". basename($file) . " {$compiledir}/{$output}"; //echo "$cmd\n"; echo `$cmd`; `$cmd`; clearstatcache(); if (!file_exists($compiledir.'/'.$output) || - !filesize($compiledir.'/'.$routput)) { + !filesize($compiledir.'/'.$output)) { echo "\n"; - echo "\n"; + echo "\n"; return; } @@ -371,4 +393,8 @@ trait Pman_Core_AssetTrait { } + + + + } \ No newline at end of file