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_:
vendor/gems/neo-viz/app/assets/stylesheets/neo-viz.css.scss
vendor/gems/neo-viz/app/assets/javascripts/neo-viz.js.coffee
vendor/gems/neo-viz/app/assets/javascripts/lib/jQuery/jquery-1.6.1.min.js
vendor/gems/neo-viz/app/assets/javascripts/lib/arbor/arbor.js
With the following line:
config.assets.precompile += %w( jquery-1.6.1.min.js arbor.js neo-viz.js neo-viz.css )
Only the css file is precompiled and made available. Why?
Also, after seeing this question ( Including assets in subdirectories with config.assets.precompile in Rails ), I tried:
config.assets.precompile += %w( jquery-1.6.1.min.js arbor.js neo-viz.js neo-viz.css lib/arbor/arbor.js arbor/arbor.js lib/jQuery/jquery-1.6.1.min.js jQuery/jquery-1.6.1.min.js )
But it made no difference. Ideas?
By default Rails only looks into 3 locations:
app/assets
,lib/assets
orvendor/assets
. Sprockets looks for JS assets in the sub-directoryjavascripts
. E.g.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:
Then create a manifest, where you include your JS files:
Finally add your manifest:
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:
Then you can add them like this, since assets outside a manifest must be added to the precompile array:
Source: 2.1 Asset Organization