是否有任何视图助手来生成CSS? [英] Are there any view helpers to generate CSS?

查看:118
本文介绍了是否有任何视图助手来生成CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢HTML佣工的想法,这让我不要写所有公共元素的HTML,同时仍然给了我完全控制,preserves模型 - 视图分离,可以强类型。

I like the idea of HTML helpers, which allows me not to write all the HTML for common elements, while still gives me full control, preserves model-view separation and can be strongly typed.

我不知道是否有可能生成CSS样式表或样式定义以同样的方式 - 使用助手鉴于标记?理想情况下,我想有一些基于一些面向对象的规则和定义,产生的CSS。

I'm wondering if it is possible to generate CSS stylesheets or style definitions the same way - using helpers in view markup? Ideally, I would like to have some of the CSS generated based on some object-oriented rules and definitions.

我找不到任何解决方案将提供比COM样式pression和合并什么了。

I can't find any solutions that will offer anything more than stylesheet compression and merging.

推荐答案

什么你问的也不是不可能,但事情就是这样默认配置,将是不可能的。其原因是,CSS文件不跨preTED之类观点。他们通过刚过。

What you're asking for isn't impossible, but the way things are configured by default it wouldn't be possible. The reason is that CSS files are not "interpreted" like views are. They are just passed through.

您可以写一些处理程序为您生成CSS,但它不会像HTML辅助东西。

You could write some handlers that generate CSS for you, but it wouldn't be anything like an HTML helper.

您可以从理论上说,编写一个HTML辅助,将插入CSS内联,但真的击败背后的CSS的目的,因为现在你需要在多个文件相同的CSS,使您的意见更大,使用更多的带宽。

You could, theoretically, write an Html helper that will insert CSS inline, but that's really defeating the purpose behind CSS, because now you need to include the same CSS in multiple files, making your views larger and using more bandwidth.

所以基本上,答案是。没有,没有什么有像HTML辅助的CSS。它最有可能是不存在的原因是,它是在后方更痛苦比它的价值。

So basically, the answer is.. No, there is nothing out there like Html helpers for CSS. And the reason it most likely doesn't exist is that it's more of a pain in the rear than it's worth.

这篇关于是否有任何视图助手来生成CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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