Hi Anton, 

The _controller that is prepended to the path allows Assetic to accurately 
calculate relative paths when your stylesheet is served from 
/app_dev.php/css/main.css rather than /css/main.css.

If this were not added all of the image references in your stylesheet would 
break when use_controller was switched on. 

Kris 


On Thursday, August 9, 2012 at 9:25 AM, Anton Serdyuk wrote:

> Hi all!
> I cannot understand purpose of fake fron controller "_controller" in
> asset target path.
> When use_controller is enabled, it is added to asset target path in
> UseControllerWorker
> (https://github.com/symfony/AsseticBundle/blob/master/Factory/Worker/UseControllerWorker.php)
> and removed in DumpCommand
> (https://github.com/symfony/AsseticBundle/blob/master/Command/DumpCommand.php#L194)
> and Routing/AsseticLoader
> (https://github.com/symfony/AsseticBundle/blob/master/Routing/AsseticLoader.php#L104).
> The only place where it is used is compiled twig template (something
> like this 
> $this->env->getExtension('assets')->getAssetUrl("_controller/js/compiled/1daeb0c_part_1_Error_2.js");).
> But in template it will never be used because if use_controller is
> enabled, then getAssetUrl in compiled template will never be called
> because routing->getPath will be called instead:
> 
> $context["asset_url"] = isset($context['assetic']['use_controller'])
> && $context['assetic']['use_controller'] ?
> $this->env->getExtension('routing')->getPath("_assetic_1daeb0c_1") :
> $this->env->getExtension('assets')->getAssetUrl("js/compiled/1daeb0c_part_1_Error_2.js");
> 
> Thanks!
> 
> -- 
> 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