从db到css文件? [英] From db to css file?

查看:42
本文介绍了从db到css文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库表中有一小部分CSS项目,需要将其转换为要包含在页面中的CSS文件.如何在Rails3中做到这一点?

I have a small set of css items in a db table that I need to turn into a css file to be included on a page. How can I do this in Rails3?

有没有一种方法可以直接从stylesheet_link标记中调用此方法?我是否需要经过一些红宝石才能打开文件并首先将其输出到某个目录中?我要在控制器中执行此操作吗?

Is there a way I can call this directly from a stylesheet_link tag? Do I need to go through some ruby to open a file and output it in some directory first? Do I do this in a controller?

css实际上是使用css与商品相关联的自己的模型.

The css is actually its own model associated to the item using the css.

我不知道,寻找解决方案的机会很小,所以在这里问.

I do not know and looking for a solution found little yet, so asking here.

简单易懂,我一直在寻找一个简单的解决方案,也许仍然可以,但这只是一个简单的开始

Simple when looked at, I was looking toward a sass or less solution and may still, but this is a simple start

推荐答案

我将创建一个Controller,该Controller从数据库中检索数据,该数据库使用View将数据呈现为级联样式表.

I would create a Controller that retrieves the data from the database that uses a View to render the data to a Cascading Style Sheet.

然后,每当需要使用生成的样式表时,您都可以引用给定的URL.

You could then reference the given URL whenever you need to use the resulting stylesheet.

这篇关于从db到css文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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