I'm trying to create a filter that, if in the production environment,
prepend http://my.cdn.net to all JavaScripts and StyleSheets and add
mtime to the file.

Therefore: /css/main.css would become http://my.cdn.net/css/main.1234567.css

It seems no matter where in the filter chain I add my filter it's
either too early and all the JS/CSS aren't included or too late and
the response has already been sent. Can anyone think of a way to do
this in the filter chain? This is what I have:

  public function execute($filterChain)
  {
    if($this->isFirstCall() && sfConfig::get('sf_environment') ==
"prod")
    {
      $response = $this->context->getResponse();
      foreach ($response->getJavascripts() as $js => $opt)
      {
        $response->removeJavascript($js);
        $response->addJavascript(sfConfig::get('app_cdn') . 'js/' .
ltrim($js, '/'), '', $opt);
      }
    }
    $filterChain->execute();
  }

I'm not sure at what point in the chain the scripts are added but it
seems no matter where I place my filter either no scripts are added
yet, or the response has already been sent.

Any suggestions would be greatly appreciated.

Cheers,
Dan
-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.


Reply via email to