added serve and removed cache for non bundle requests
This commit is contained in:
parent
d1c0f295ef
commit
155a1b56e1
@ -2,19 +2,9 @@
|
|||||||
|
|
||||||
class Controller_assets_scss extends Crunchbutton_Controller_AssetBundle {
|
class Controller_assets_scss extends Crunchbutton_Controller_AssetBundle {
|
||||||
public function init() {
|
public function init() {
|
||||||
$this->cacheServe('crunchr-file-scss');
|
$path = c::config()->dirs->www.'assets/scss/';
|
||||||
}
|
|
||||||
|
|
||||||
public function getData() {
|
|
||||||
|
|
||||||
$path = $file = c::config()->dirs->www.'assets/scss/';
|
|
||||||
$file = c::getPagePiece(2).'.scss';
|
$file = c::getPagePiece(2).'.scss';
|
||||||
|
|
||||||
$data = Scss::compile($path.$file);
|
Scss::serve($path.$file);
|
||||||
|
|
||||||
$data = preg_replace('/\t|\n/','',$data);
|
|
||||||
$mtime = time();
|
|
||||||
|
|
||||||
return ['mtime' => $mtime, 'data' => $data];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,4 +17,22 @@ class Crunchbutton_Scss extends Cana_Model {
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function serve($file) {
|
||||||
|
|
||||||
|
$data = self::compile($file);
|
||||||
|
$mtime = filemtime($file);
|
||||||
|
|
||||||
|
header('HTTP/1.1 200 OK');
|
||||||
|
header('Date: '.date('r'));
|
||||||
|
header('Last-Modified: '.gmdate('D, d M Y H:i:s',$mtime).' GMT');
|
||||||
|
header('Accept-Ranges: bytes');
|
||||||
|
header('Content-Length: '.strlen($data));
|
||||||
|
header('Content-type: text/css');
|
||||||
|
header('Vary: Accept-Encoding');
|
||||||
|
header('Cache-Control: max-age=290304000, public');
|
||||||
|
|
||||||
|
echo $data;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user