I\'m having trouble getting vendorized assets to be compiled as root files.
I want to have the following assets available standalone (not packaged with other assets_:
By default Rails only looks into 3 locations: app/assets
, lib/assets
or vendor/assets
. Sprockets looks for JS assets in the sub-directory javascripts
. E.g.
app/assets/javascripts/arbor.js
lib/assets/javascripts/arbor.js
vendor/assets/javascripts/arbor.js
If you want to see where Rails is looking for you can use this in the console: Rails.application.config.assets.paths
What you can do is add your custom path to the pipeline:
# @file: config/application.rb
config.assets.paths << Rails.root.join("vendor", "gems", "neo-viz", "app", "assets", "javascripts")
Then create a manifest, where you include your JS files:
# @file: /vendor/gems/neo-viz/app/assets/javascripts/neo-viz.js
//= require lib/jQuery/jquery-1.6.1.min
//= require lib/arbor/arbor
//= require neo-viz
Finally add your manifest:
config.assets.precompile += %w( neo-viz.js )'
If you still want to add them separatly, which I do not see the point, why not include them in a manifest, then you'll have to add all the possible path prefix so Rails knows where to look:
# @file: config/application.rb
config.assets.paths << Rails.root.join("vendor", "gems", "neo-viz", "app", "assets", "stylesheets")
config.assets.paths << Rails.root.join("vendor", "gems", "neo-viz", "app", "assets", "javascripts")
config.assets.paths << Rails.root.join("vendor", "gems", "neo-viz", "app", "assets", "javascripts", "lib", "jQuery")
config.assets.paths << Rails.root.join("vendor", "gems", "neo-viz", "app", "assets", "javascripts", "lib", "arbor")
Then you can add them like this, since assets outside a manifest must be added to the precompile array:
config.assets.precompile += %w( jquery-1.6.1.min.js arbor.js neo-viz.js neo-viz.css )
Source: 2.1 Asset Organization