X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Asset.php;h=eb5c0538de30ffc395121bf6ff6c9b9fe56b6250;hp=bae9ecf54909a14986d2fdb9885bc41600308faf;hb=HEAD;hpb=b2d22e8e22ab10c6622d8d7fb0edb6cd56ef5ccd diff --git a/Asset.php b/Asset.php index bae9ecf5..3e49f8eb 100644 --- a/Asset.php +++ b/Asset.php @@ -26,6 +26,7 @@ class Pman_Core_Asset extends Pman { var $types = array( 'css' => 'text/css', 'js' => 'text/javascript', + 'map' => 'application/json' ); function getAuth() @@ -36,8 +37,6 @@ class Pman_Core_Asset extends Pman { function get($s='', $opts = Array()) { - - $this->sessionState(0); $bits = explode('/', $s); @@ -46,17 +45,23 @@ class Pman_Core_Asset extends Pman { $this->jerr("invalid url"); } + $ext = $bits[0]; + if (preg_match('/\.map$/',$_SERVER['REQUEST_URI'])) { + $ext = 'map'; + } + $s = str_replace('/', '-', $bits[1]); + $ui = posix_getpwuid(posix_geteuid()); $ff = HTML_FlexyFramework::get(); $compile = self::getCompileDir($bits[0], '', false); - $fn = $compile . '/'. $s .'.'. $bits[0]; + $fn = $compile . '/'. $s .'.'. $ext; if (!file_exists($fn)) { - header('Content-Type: '. $this->types[$bits[0]]); + header('Content-Type: '. $this->types[$ext]); echo "// compiled file not found = $fn"; exit; @@ -107,7 +112,7 @@ class Pman_Core_Asset extends Pman { $fh = fopen($fn,'r'); fpassthru($fh); fclose($fh); - $content = $data; + } @@ -140,6 +145,7 @@ class Pman_Core_Asset extends Pman { switch($type) { case 'js': case 'css': + case 'scss': $compile_dir .= implode("-", array( $ui['name'], $module, @@ -152,6 +158,7 @@ class Pman_Core_Asset extends Pman { return false; } + if (file_exists($compile_dir)) { return $compile_dir; }