Question

Ruby Version: 2.0.0

Rails Version: 4.0.1

This is a follow-up to my previous question: Why do assets fail to load in production mode?. This was mostly fixed by setting config.serve_static_assets = true in production.rb.

However, now I still have one stylesheet and one javascript file that aren't being pulled in. which (coincidentally) should be pulling in it's own set of dependencies.

In my application.html.erb file I have:

<%= stylesheet_link_tag "application", media: "all"  %>
<%= stylesheet_link_tag "frontend", media: "all" %>

However, that seems to be parsing to two very different things. Here is the output:

<link href="/assets/application-1c1eb49916824f465443a709172a580a.css" media="all" rel="stylesheet">
<link href="/stylesheets/frontend.css" media="all" rel="stylesheet">

And in case it makes a difference, here is what frontend.css actually looks like:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require_tree ./frontend
 *= require front_end
 */

What am I missing?

Was it helpful?

Solution

In config/application.rb, add frontend.css to config.assets.precompile:

# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w( frontend.css )

Don't forget to do this if you create other CSS and JavaScript manifest files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top