Reputation: 13012
I have a file called hammer.js
within my vendor folder i would like to keep my 3rd party js in vendor/assets/javascripts
and all home made stuff in app/assets/javascripts
.
But when precompiling my assets rails won't fetch my assets from vendor. within my manifest file i have specified //= require vendor
that didn't work so i tried //= require hammer
and i tried //= require hammer.js
from what i read these solutions seemed to work for some other people. But its not loading it at all
Note: I do bundle exec rake assets:precompile
each time and the check public assets and i render the page and look at the loaded resources each time i try alternative.
EDIT:
//= require jquery
//= require jquery.ui.all
//= require jquery_ujs
//= require_tree ../../../vendor/assets/javascripts
//= require_tree .
so i tried this. but its still not loading
within the config/environments/production.rb i have the following
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
sorry this would be the first time i have set up js in rails.
Upvotes: 1
Views: 218
Reputation: 30463
If you want hammer.js
to be precompiled as a separated file, you should change config.assets.precompile
in config/environments/production.rb
, I guess.
Like config.assets.precompile += %w{ hammer.js }
, and you will see public/assets/hammer.js
.
Upvotes: 1
Reputation: 38645
Try loading them as follows (note the path):
//= require_tree ../../../vendor/assets/javascripts
Upvotes: 2