Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails javascript asset missing after precompile

the Rails Guides says:

If there are missing precompiled files in production you will get an Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError exception indicating the name of the missing file(s).

I do execute:

bundle exec rake assets:precompile

however I don't get any error, and my javascript file is missing in the manifest.yml. Also it's not appearing in public/assets, so the problem is only on production.

I have in the application.js

//= require formalize/jquery-formalize

What am I missing?

Thanks.

like image 262
valk Avatar asked Apr 18 '12 22:04

valk


People also ask

What is asset Precompile?

Manifests and directives. rails assets:precompile is the task that does the compilation (concatenation, minification, and preprocessing). When the task is run, Rails first looks at the files in the config.assets.precompile array. By default, this array includes application.js and application.css .

What does rake assets Clean do?

rake assets:clean removes compiled assets. It is run by cap deploy:assets:clean to remove compiled assets, generally from a remote server.


1 Answers

Actually two things needed to do:

config.assets.precompile += %w( *.js *.css )

as described here, and

config.serve_static_assets = true

for local production testing when using

rail s

of course using

rake assets:precompile

however in my case - without config.assets.precompile this would have no effect since the manifest didn't contain any reference to my javascript file.

HTH.

like image 122
valk Avatar answered Nov 13 '22 08:11

valk