Example #1
0
 public static function serverAsset($dev)
 {
     $headers = Raptor::getRequest()->header;
     $route = $headers->get('PATH_INFO');
     $web_location = Location::get('web_bundles');
     $file = $web_location . $route;
     $js = new AssetCollection(array(new GlobAsset($file)));
     // the code is merged when the asset is dumped
     $response = new Response($js->dump());
     if (preg_match("/(\\.css)\$/", $route)) {
         $response->addHeader('Content-Type', 'text/css');
     } else {
         $response->addHeader('Content-Type', 'application/javascript');
     }
     if ($dev == FALSE) {
         $response->setCache(true, 3, true);
     }
     $response->sendResponse();
     exit;
 }