I'm using Jammit in my Rails application and am getting an error like this on my server:
NetworkError: 404 Not Found - http://localhost:3000/javascripts/landing/carousel_background.js/javascripts/landing/front.js"
The javascript files live in public/javascripts/landing, and my assets.yml looks like this:
embed_assets: off
gzip_assets: off
compress_assets: off
javascripts:
....
front:
- public/javascripts/landing/carousel_background.js
- public/javascripts/landing/front.js
...
My stylesheets get read fine but none of my js files. It looks like the js filenames are being concatenated and read as a single file instead of two separate files. Any idea what might be going on?
Edit: Here's what the head of my layout looks like:
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,300' rel='stylesheet' type='text/css' />
<%= render 'shared/title' %>
<%= render 'shared/import_styles' %>
<%= yield :stylesheets %>
<%= render 'shared/import_ie_styles' %>
<%= include_stylesheets :landing, :media => :all %>
<%= render 'shared/import_scripts' %>
<%= include_javascripts :landing %>
<%= yield :head %>
<%= render 'shared/google_analytics' %>
<%= csrf_meta_tag %>
<%= favicon_link_tag %>
</head>
and my view has these content_for tags:
<% content_for :head do %>
<%= include_javascripts :front %>
<% end %>
<% content_for :stylesheets do %>
<%= include_stylesheets :front, :media => :all %>
<% end %>
Keep in mind that Jammits finished files are not in the same place as normal assets. You can't call the normal JavaScript methods such as javascript_include_tag
, if you call include_javascripts(:front)
it should work fine.