如何使用CSS与ruby on rails应用程序? [英] How do I use CSS with a ruby on rails application?

查看:203
本文介绍了如何使用CSS与ruby on rails应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用CSS与RoR?当我链接到外部,我永远不能看到的文件。我将css文件复制到每个文件夹,我可以想到...视图,控制器,模板,没有什么似乎工作。

How do I use CSS with RoR? When I link externally, I'm never able to see the files. I cp'd the .css file to every folder I could think of...views, controller, template, and nothing seems to work.

我需要什么做启用外部CSS文件与rails应用程序?

What do I need to do to enable external CSS files with a rails application? I'm new to rails, so forgive me if this is basic.

推荐答案

将CSS文件放在public / stylesheets中,然后使用:

Put the CSS files in public/stylesheets and then use:

<%= stylesheet_link_tag "filename" %>

链接到视图中的布局或erb文件中的样式表。

to link to the stylesheet in your layouts or erb files in your views.

同样,你把公共/图像和javascript文件中的图像公开/ javascripts。

Similarly you put images in public/images and javascript files in public/javascripts.

这篇关于如何使用CSS与ruby on rails应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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