FloatingRock
FloatingRock

Reputation: 7065

Rails: Assets properly fingerprinted but not stylesheets and javascripts

So this is strange.. On my site, the image assets are getting properly fingerprinted but not the stylesheets and javascript files.

Here's what the link looks like in my view:

<%= stylesheet_link_tag    "website", media: "all", 
                           "data-turbolinks-track" => true %>

<%= javascript_include_tag "website", 
                           "data-turbolinks-track" => true %>

And this is what it looks like once pushed to production:

<link data-turbolinks-track="true" href="/stylesheets/website.css" 
      media="all" rel="stylesheet" />

<script data-turbolinks-track="true" 
      src="/javascripts/website.js"></script>

.. while my images are properly fingerprinted:

<img src="assets/website/white-logo-904f6978b5ecfdad3fdb8ad8d3a995b6.png">

Any ideas as to why I'm getting this strange behavior, and how I can get it fixed?

Rails v4.0.4 / Ruby 2.1.2

Upvotes: 0

Views: 29

Answers (1)

Carlos Ramirez III
Carlos Ramirez III

Reputation: 7434

By convention, the Rails asset pipeline recognizes application.js and application.css as the main asset manifest files.

If you want to include separate files, then you'll need to specify them to be precompiled in the environment config or in an initializer.

Try this:

# config/production.rb
config.assets.precompile += %w( website.js website.css )

Upvotes: 1

Related Questions