我最近重写了我的一个Rails 3.2.13应用程序以使用Rails 4.我在我的Rails 3应用程序中使用了twitter-bootstrap-rails 2.1.2.当我重写Rails 4版本时,它开始使用2.2.8版本.我在我的开发和生产服务器上使用Phusion Passenger 4.0.20来托管我所有的Rails应用程序.
在我的Rails 3应用程序中,背景图像在localhost和生产中正确显示.但是,当我使用Rails 4和当前版本的twitter-bootstrap-rails重写应用程序时,我注意到背景图像正确显示但是当我在生产中部署它时,背景图像不会显示.
我尝试了以下CSS,但背景图像只出现在localhost中.第一个语句是在我的Rails 3应用程序中在localhost和production中运行良好的原始CSS代码.
background: url(/assets/landingpage2.jpg); width: 574px; height: 650px;
background: url(../assets/landingpage2.jpg); width: 574px; height: 650px;
background-image: url(../assets/landingpage2.jpg); width: 574px; height: 650px;
background-image: url("../assets/landingpage2.jpg"); width: 574px; height: 650px;
background-image: url("/assets/landingpage2.jpg"); width: 574px; height: 650px;
Run Code Online (Sandbox Code Playgroud)
这是包含最初工作的背景语句的类:
.landing-cube-menu {
font-weight: bold;
font-size: 150%;
line-height: 100%;
background: url(/assets/landingpage2.jpg); width: 574px; height: 650px;
margin:0 auto;
}
Run Code Online (Sandbox Code Playgroud)
以下是我在视图中使用的代码:
<div class="header-cube-menu" style="position: relative;">
<div class="header-store" style="position: absolute;">
<p><%= link_to "Online Store", store_path %></p>
</div>
<div class="header-about" style="position: …Run Code Online (Sandbox Code Playgroud) 什么是最简单的(有一种简单的方法吗?)在rails 3.1资产管道中使用Less(与Sass/Scss结合使用)?
我想加载像foo.css.less这样的文件,就像我为bar.css.scss做的那样
我找到了一些不适合我的解决方案(没有尝试过很多):https: //github.com/thisduck/ruby-less-js/issues/2
我们的想法是以干净的方式使用Twitter Bootstrap.提前致谢
所以我在我的Rails应用程序中包含了样式表的URL ,但它将所有内容都抛入了haywire.
我把它包括在内:
<%= stylesheet_link_tag('http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css', 'style', 'css3buttons', 'jquery.lightbox-0.5', :media => 'all') %>
Run Code Online (Sandbox Code Playgroud)
我想要做的是,当我将类应用于html标签时,应用Twitter样式.理想情况下,我想要做的是让它甚至覆盖我的"样式"表中的样式 - 这是我整个应用程序的样式表.
是否有可能以简单的方式完成此操作,而无需为我想要使用的每个元素修改样式?