为Symfony中的特定操作禁用CSS样式表 [英] Disable CSS stylesheet for a specific action in Symfony

查看:95
本文介绍了为Symfony中的特定操作禁用CSS样式表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Symfony中,有什么方法可以禁用view.yml中的样式表以执行特定操作吗?

Is there any way of disabling a stylesheet in view.yml for a specific action in Symfony?

例如,我已经在view.yml中找到了它:

For example I've got this in my view.yml:

default:
  stylesheets:    [default.css]

我希望能够做类似的事情:

I want to be able to do something like:

displaySuccess:
  stylesheet: [!default.css]

仅在displaySuccess中禁用default.css

to disable default.css in displaySuccess only

这是否可行,或者我必须明确指出哪些模块/操作应具有default.css?

Is this possible or do I have to explicitly say which modules/actions should have default.css?

推荐答案

您可以通过执行以下操作,将样式表删除或添加到模块view.yml:

You can remove or add stylesheets to a modules view.yml by doing the following:

displaySuccess:
  stylesheet: [-default]

将从显示操作中删除default.css.简而言之

would remove default.css from the display action. Simply putting

displaySuccess:
  stylesheet: [-*]

将删除所有样式表.

这篇关于为Symfony中的特定操作禁用CSS样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆