Closed ismell closed 12 years ago
in your config.yml you can specify
hearsay_require_js:
...
base_url: /js
in your main config, and then in your config_dev.yml do:
hearsay_require_js:
base_url: /app_dev.php/js
and that should get you want you want.
Fixed; note that @bigethan 's workaround breaks as a result, though. The base_url specified in the config will now be automatically appended to the request root, regardless of whether it contains a leading slash.
Awesome thanks!
Your commit works as long as your .htaccess is working to hide the /app.php part of the URL. Maybe it should check if kernel.debug is set? Or maybe see how assetic figures out the URL for production?
Base URL is now chosen based on the value of %assetic.use_controller%. If a controller is being used for assets, the root path (e.g. app.php or app_dev.php) will be included in the base URL (unless it's being hidden by .htaccess). Otherwise, the base URL is just the one specified in your config.
This feels a bit tightly tied to the Assetic Bundle implementation; if anyone has thoughts on a better way to do it, suggestions or pull requests are appreciated :)
My template has the following
My Config looks like so
When I hit the following url: http://rangelwed/app_dev.php/reception/edit
My require block generates the following
if you notice the baseUrl it's relative. This causes the request to wedcore/edit to go to http://rangelwed/app_dev.php/reception/js/wedcore/edit.js. This is incorrect and instead should go to http://rangelwed/app_dev.php/js/wedcore/edit.js.
So the base URL should be rendered as /app_dev.php/js/.
Thanks, Raul