X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=AssetTrait.php;h=27b9c4b0b06b1fa228eca8785a72b3769359a074;hp=36ce845382e05e5b98963759d3b36f0520d365a5;hb=HEAD;hpb=c99710918ed71fdf5e2f76869b0c417600b0887b diff --git a/AssetTrait.php b/AssetTrait.php index 36ce8453..0067d6f2 100644 --- a/AssetTrait.php +++ b/AssetTrait.php @@ -78,8 +78,8 @@ trait Pman_Core_AssetTrait { $ff = HTML_FlexyFramework::get(); - if (!empty($ff->Pman['isDev']) && !empty($_REQUEST['isDev'])) { - echo "\n"; + if (empty($compiledir) || (!empty($ff->Pman['isDev']) && !empty($_REQUEST['isDev']))) { + echo "\n"; $this->assetArrayToHtml($files,'js'); return; } @@ -127,13 +127,11 @@ trait Pman_Core_AssetTrait { case 'js': echo ''."\n"; break; - case 'css': case 'css': echo ''."\n"; break; } - } } @@ -262,7 +260,7 @@ trait Pman_Core_AssetTrait { file_put_contents($compiledir.'/'.$output , $x->minify( $this->baseURL.$asset)); clearstatcache(); if (!file_exists($compiledir.'/'.$output) || - !filesize($compiledir.'/'.$routput)) { + !filesize($compiledir.'/'.$output)) { echo "\n"; $this->assetArrayToHtml($files,'css'); return; @@ -285,18 +283,45 @@ 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->outputSCSSDir("{$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)); + $maxtime= max($maxtime, filemtime($fn)); } @@ -311,17 +336,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)) { @@ -336,19 +358,26 @@ trait Pman_Core_AssetTrait { die("INSTALL sassc"); } - $fd = dirname($fp); - - - $cmd = "{$sassc} --style=compressed --sourcemap=auto -I {$fd} -I {$this->rootDir}/roojs1/scss/bootstrap $smod.scss {$compiledir}/{$output}"; + + $ver = `$sassc --version`; + $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 ". 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)) { - echo "\n"; - echo "\n"; + !filesize($compiledir.'/'.$output)) { + echo "\n"; + echo "\n"; return; } @@ -366,4 +395,8 @@ trait Pman_Core_AssetTrait { } + + + + } \ No newline at end of file