Don Giulio
Don Giulio

Reputation: 3294

assets are precompiled but app still looks for all the separate js files

My capistrano is precompiling correctly all the assets in the pipeline, and generating the application.js and application.css files with the complete wrap up.

The problem is that my application is still looking for all the separate .js and .css files, that aren't present on the server, and this generates lots of 404 not found responses from the nginx server.

the css and javascript are loaded in the app/views/layouts/application.html.haml file with:

= stylesheet_link_tag "application", media: "all"
= javascript_include_tag "application"

and in the app/assets/javascript/application.js the components are loaded with:

//= require jquery
//= require jquery_ujs
//= require jquery.ui.datepicker
//= require jquery.timepicker
//= require colorbox-rails
//= require twitter/bootstrap
//= require_tree .

How can I get the app to use only the single precompiled file when the precompile has happened?

thanks,

Upvotes: 2

Views: 79

Answers (1)

Alex Wayne
Alex Wayne

Reputation: 187204

Compiled assets is a feature of the production environment. In the development environment you typically don't want this. If a line raises an exception, you want to know which file it's in so you can easily it.

This is governed by this line in your config/environments/*.rb config files:

config.assets.compress = true # or false

If true, it excepts combined assets. If false, it expects assets in their own files.

In development this is typically false. In production this is typically true. But either way it's an environment specific setting, so you wont get it to work differently in two places under the same environment.

Perhaps you want to set up a staging environment instead?

Upvotes: 1

Related Questions