AsseticBundle / CompassFilter:当模板无法编译时有什么方法可以抛出异常吗?
我想知道是否有人可以帮助我结合 Symfony 2 的 dev
环境进行一些 AsseticBundle 配置。
每次在 dev
环境中加载页面时,Assetic 都会重新编译所有资源,在我的例子中,我使用 CompassFilter
编译 Sass 文件。
我的问题是,当我有一个格式错误的 Sass 文件时,我的页面只是加载而没有任何生成的样式表 - 相反,我希望 Assetic 向我显示 Compass/Sass 编译器输出,就好像发生了异常一样(即我得到 Symfony2“oops”屏幕) 。
有谁知道是否有配置可以实现此目的?
我当前的 config.yml 是:
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: ~
config_dev.yml 仅覆盖一行:
assetic:
use_controller: true
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,您所要求的内容不受支持,因为样式表是在请求时处理的,而不是在请求 HTML 时处理的。但是,如果您直接请求引用的样式表,您应该能够看到错误。
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.