【发布时间】:2016-11-06 21:24:26
【问题描述】:
目前我的事件 CSS 位于 app/assets/stylesheets/pages/events.scss 中,在开发模式下它看起来很好并且资产已加载。但是在生产中,这些页面似乎根本没有加载。我不确定如何解决这个问题。我看过Rails 4: assets not loading in production,但我不熟悉config.assets.precompile += %w( *.js ^[^_]*.css *.css.erb),因为看起来路径本身在生产中不起作用。
app/assets/stylesheets/application.scss:
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
*#= require bootstrap-wysihtml5
*#= require rails_bootstrap_forms
*#= require jquery.jcrop
*= require custom
*= require_self
*/
@import "bootstrap-sprockets";
@import "bootstrap";
@import "scaffolds";
app/views/events/index.html.erb:
<% content_for :head do %>
<%= stylesheet_link_tag "pages/events", :media => "all" %>
<% end %>
app/assets/stylesheets/pages/events.scss
@import "globals/helpers";
@import "vendors/animate";
.events-bar {
/* a[class*="btn"] {
height: 36px;
display: inline-block;
}*/
#toggleBar {
margin-top: 14px;
}
.btn-dashboard {
background-color: #fdf9ff;
color: $eventsColour !important;
&:hover {
background-color: $eventsColour-dark !important;
}
}
}
很难调试,因为它在开发中运行良好,但在生产环境中运行良好。看起来子目录(app/assets/stylesheet/pages/*.scss)中的所有文件都不能在生产环境中工作。任何见解都会有所帮助,谢谢。
【问题讨论】:
-
你能分享你的 Gemfile 吗?
标签: css ruby-on-rails production-environment