case 'js':
echo '<script type="text/javascript" src="'. $f. '"></script>'."\n";
break;
+ case 'css':
case 'css':
echo '<link rel="stylesheet" href="'. $f. '"/>'."\n";
break;
// 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;
}
//print_r($relfiles);
require_once 'Pman/Core/Asset.php';
- $compiledir = Pman_Core_Asset::getCompileDir('scss', '', true);
+ $compiledir = Pman_Core_Asset::getCompileDir('css', '', true);
if (!file_exists($compiledir)) {
- $smod = str_replace('/','.',$path);
-
+
$output = date('Y-m-d-H-i-s-', $maxtime). $smod .'-'.md5(serialize(array($this->baseURL, $ar))) .'.css';
- $asset = $ff->project == 'Pman' ? '/Core/Asset/scss/' : '/Asset/scss/';
+ $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 'HTML/Scss.php';
- $scss = new HTML_Scss();
-
- $scss->setSourceMap(HTML_Scss::SOURCE_MAP_FILE);
- $scss->setSourceMapOptions(array(
- //'sourceRoot' => $file['sourceMapRootpath'],
- // an optional name of the generated code that this source map is associated with.
- //'sourceMapFilename' => "{$file['baseDir']}/{$file['name']}.map",
- // url of the map
- //'sourceMapURL' => "{$file['name']}.map",
- // absolute path to a file to write the map to
- //'sourceMapWriteTo' => "{$file['baseDir']}/{$file['name']}.map",
-
- // output source contents?
- 'outputSourceFiles' => false,
-
- // this is added to the file path.
- 'sourceMapRootpath' => '../',
-
- // this is removed from the filepath.
- //'sourceMapBasepath' => $rootDir .'/roojs1/scss'
- 'sourceMapBasepath' => dirname($fp)
+ require_once 'System.php';
+ static $sassc = false;
+ if ($sassc === false) {
+ $sassc = System::which("sassc");
+ }
+ if (empty($sassc)) {
+ die("INSTALL sassc");
+ }
+
+ $fd = dirname($fp);
- ));
-
- $scss->setImportPaths($this->rootDir .'/roojs1/scss');
- $scss->setFormatter('Expanded');
-
- echo $scss->compile("{$file['variables']}\n@import \"{$mod}.scss\";");
- exit;
-
- file_put_contents($compiledir.'/'.$output, $scss->compile("{$file['variables']}\n@import \"{$mod}.scss\";"));
-
- //print_r($relfiles);
-
- require_once 'HTML/SCSS.php';
-
- require_once 'HTML/CSS/Minify.php';
- $x = new HTML_CSS_Minify(substr($relpath,0,-1), $dir, $relfiles);
+
+ $cmd = "{$sassc} --style=compressed --sourcemap=auto -I {$fd} -I {$this->rootDir}/roojs1/scss/bootstrap $smod.scss {$compiledir}/{$output}";
+ //echo "$cmd\n"; echo `$cmd`;
+ `$cmd`;
- file_put_contents($compiledir.'/'.$output , $x->minify( $this->baseURL.$asset));
+
clearstatcache();
if (!file_exists($compiledir.'/'.$output) ||
!filesize($compiledir.'/'.$routput)) {
echo "<!-- compile did not generate files : " . basename($compiledir) . "/{$output} -->\n";
- $this->assetArrayToHtml($files,'css');
+ echo "<script type=\"text/javascript\">alert('Failed to compile {$fp}');</script>\n";
return;
}