config.yml:
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ FrontendBundle ]
#java: /usr/bin/java
ruby: /usr/bin/ruby
sass: /usr/bin/sass
read_from: %kernel.root_dir%/../../web/
write_to: %kernel.root_dir%/../../web/
filters:
cssrewrite: ~
scss:
style: 'expanded'
compass: true
apply_to: "\.scss$"
compass:
bin: /usr/bin/compass
images_dir: %kernel.root_dir%/../../src/FrontendBundle/Resources/assets/images
generated_images_path: %kernel.root_dir%/../../src/FrontendBundle/Resources/public/images/sprites
http_generated_images_path: /images/sprites
Template:
<?php foreach ($view['assetic']->stylesheets(
array('@FrontendBundle/Resources/assets/scss/homepage.scss'),
array('compass'),
array('output' => 'css/homepage.css')
) as $url):
$styles[] = '<link rel="stylesheet" href="'. $view->escape($url) .' " />' ?>
<?php endforeach; ?>
Prod environment works just fine. css/homepage.css is generated, and there is link to it in result html.
Problems are with dev environment. If I try to generate css dynamically i get "Unable to generate a URL for the named route..." error, with "bundles" option set in config_dev.yml and assetic routes in roting_dev.yml. This is only solutions I found for this issue, none of them worked.
If I try to do prod-like, with setting "use_controller" to false, in result html I get link to "homepage_homepage_1.css" instead of "homepage.css", which is not generated.