Thanks Paulo. Your suggestion put me on the right track. After playing
AssetHelper.php I decided I didn't want to override the entire helper
so I extended sfWebResponse's getJavascripts() and getStylesheets()
and was able to achieve the same results. Thanks so much for the
advice.

~Dan

On Jan 21, 4:07 am, Paulo Magalhaes <[email protected]> wrote:
> Hi Dan,
>
> I do something similar but I didn't go through the filter route.
>
> By overwriting the _compute_public_path() in AssetHelper.php you can
> achieve the same: just declare the cdn hostname in your app.yml (leave
> blank for dev) and prepend that to the urls in that function.
>
> Cheers,
> PM
>
> dancablam wrote:
> > I'm trying to create a filter that, if in the production environment,
> > prependhttp://my.cdn.netto all JavaScripts and StyleSheets and add
> > mtime to the file.
>
> > Therefore: /css/main.css would becomehttp://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