Correct me if I am wrong but controller will be aways used in debug
mode for including assets from web directory?
In my project I am including around 20 files using assetic. In prod
env they are all merged into 2 files. When I use controller to include
them in debug mode I wait around 30s for page to be fully loaded. Each
request for css/js file takes around 2s.
Thats why I hacked a bit assetic helper function so controller is no
being used. I save precious seconds during developing and refreshing
page every minute :)

<?php
foreach ($view['assetic']->stylesheets($assets = array(
  'css/layout.css',
  'css/file1.css',
  'css/file2.css',
  'css/file3.css'), array()) as $key => $url) {
  echo '<link rel="stylesheet" href="'.($view["tools"]->isDebug() ?
$view['assets']->getUrl($assets[$key]) : $view->escape($url)).'"
type="text/css" />';
}
?>

I tried to define array $assets  variable out of stylesheets function
but then assetic:dump command is not working - gives me undefined
$assets variable error.

On 16 Maj, 17:17, Kris Wallsmith <[email protected]> wrote:
> I’m working on a feature that will decouple whether assets are combined from 
> the current debug mode. I think this will accomplish what you’re looking for.
>
> {% javascripts ‘foo.js’ ‘bar.js’ filter=‘?yui_js’ combine=true %} ... {% 
> endjavascripts %}
>
> This would always combine foo.js and bar.js but would not apply the YUI 
> compressor unless your app is in debug mode.
>
> KrisOn Monday, May 16, 2011 at 8:06 AM, Venzon wrote:
>
> I pasted code from my use case in previous post.
>
>
>
>
>
>
>
> > In dev mode I cannot afford to use controller for including assets
> > because it takes like 30 seconds to reload page and load all 20
> > javascripts/stylesheets. Maybe my machine in not fast enough but I
> > think many will have similar problem. Including each asset thru
> > controller means launching sf2 framework instance.
>
> > Luke
>
> > On 16 Maj, 15:24, Kris Wallsmith <[email protected]> wrote:
> > > No, use_controller is still a global setting. I don’t see a need for 
> > > specifying this per asset — what is your use case?
>
> > > Thanks,
> > > KrisOn Monday, May 16, 2011 at 4:32 AM, Venzon wrote:
>
> > > @Kris Wallsmith: I noticed a lot of new changes in your assetic
>
> > > > bundle. Config file looks very interesing:
>
> > > >https://github.com/symfony/symfony/blob/fd3a8535979b2525c55cd1434ab8f...
>
> > > > Is there now a way not to mark some assets as being located in web
> > > > directory (not using controller) ?
>
> > > > --
> > > > If you want to report a vulnerability issue on symfony, please send it 
> > > > to security at symfony-project.com
>
> > > > You received this message because you are subscribed to the Google
> > > > Groups "symfony developers" 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-devs?hl=en
>
> > --
> > If you want to report a vulnerability issue on symfony, please send it to 
> > security at symfony-project.com
>
> > You received this message because you are subscribed to the Google
> > Groups "symfony developers" 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-devs?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" 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-devs?hl=en

Reply via email to