AsseticBundle / CompassFilter: Any way to throw an exception when a template can't compile?

StackOverflow https://stackoverflow.com/questions/8771747

  •  14-04-2021
  •  | 
  •  

Question

I'm wondering if anyone can help me with some AsseticBundle configuration in conjunction with Symfony 2's dev environment.

Each time a page loads in the dev environment Assetic will recompile any assets, in my case I am compiling Sass files using the CompassFilter.

My problem is that when I have a malformed Sass file my page simply loads without any generated stylesheet - instead I want Assetic to show me the Compass/Sass compiler output as if an exception had occurred (i.e. I get the Symfony2 "oops" screen).

Does anyone know if there is a configuration to achieve this?

My current config.yml is:

assetic:
    debug:          %kernel.debug%
    use_controller: false
    sass: /var/lib/gems/1.8/bin/sass
    filters:
        compass:
          bin: /var/lib/gems/1.8/bin/compass
          apply_to: "\.scss$"
        scss: ~

with config_dev.yml overriding only one line to:

assetic:
    use_controller: true
Was it helpful?

Solution

No, what you ask for is not supported because the stylesheet is processed when it is requested, not when the HTML is requested. However, you should be able to see the error if you request the referenced stylesheet directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top