I have these files in my lib / assets folder (sketchyPad is the jQuery plugin for drawing on html5 canvas, and farbastic is the color set used by sketchyPad):
lib/ |-- assets | |-- javascripts | | `-- lib.js | `-- sketchyPad | |-- README.md | |-- brushes | | |-- simple.js | | `-- smooth.js | |-- example | | |-- index.html | | |-- jquery-ui-1.8.16.custom | | | |-- css | | | | `-- ui-lightness | | | | |-- images | | | | | |-- ui-bg_diagonals-thick_18_b81900_40x40.png | | | | | |-- ui-bg_diagonals-thick_20_666666_40x40.png | | | | | |-- ui-bg_flat_10_000000_40x100.png | | | | | |-- ui-bg_glass_100_f6f6f6_1x400.png | | | | | |-- ui-bg_glass_100_fdf5ce_1x400.png | | | | | |-- ui-bg_glass_65_ffffff_1x400.png | | | | | |-- ui-bg_gloss-wave_35_f6a828_500x100.png | | | | | |-- ui-bg_highlight-soft_100_eeeeee_1x100.png | | | | | |-- ui-bg_highlight-soft_75_ffe45c_1x100.png | | | | | |-- ui-icons_222222_256x240.png | | | | | |-- ui-icons_228ef1_256x240.png | | | | | |-- ui-icons_ef8c08_256x240.png | | | | | |-- ui-icons_ffd27a_256x240.png | | | | | `-- ui-icons_ffffff_256x240.png | | | | `-- jquery-ui-1.8.16.custom.css | | | `-- js | | | `-- jquery-ui-1.8.16.custom.min.js | | |-- jquery.min.js | | `-- mattfarina-farbtastic-4bb6bbf | | |-- CHANGELOG.html | | |-- LICENSE.txt | | |-- README.html | | |-- README.md | | |-- demo1.html | | |-- demo2.html | | |-- farbtastic.css | | |-- farbtastic.js | | |-- farbtastic.min.js | | |-- marker.png | | |-- mask.png | | `-- wheel.png | |-- sketchyPad.css | `-- sketchyPad.js
So, I want to include sketchyPad.js, sketchyPad.css, as well as all js in the brush folder, as well as the farbtastic.min js file.
In app / assets / javascripts / application.js I put:
//= require sketchyPad (this part works fine and correctly includes sketchyPad.js)
but I also want to enable
lib/assets/sketchyPad/brushes/simple.js lib/assets/sketchyPad/brushes/smooth.js
and any other js files in the brush folder, how can I use require_directory if it's not in the application / assets, but in lib / assets or vendor / assets?
Update:
I tried
require_tree sketchyPad
but errors with:
require_tree argument must be a relative path
I tried
require_tree ./sketchyPad
but errors with:
require_tree argument must be a directory
I think that require_tree should refer to the app / assets folder, but putting something like
require_tree ./../lib/assets/sketchyPad/brushes
also gives an error:
require_tree argument must be a directory
At the same time, I donโt want to include the entire sketchyPad tree, because it contains some js files that I donโt want to include ... for example, examples and my own version of the older jQuery.
UPDATE:
As a result, I created lib.js in the lib / assets / javascripts folder with a manifest to include sketchyPad js files relative to the lib / assets folder, and not the app / assets folder.
in app / assets / javascripts / application.js I put:
//= require jquery //= require jquery_ujs //= require jquery-ui //= require lib
and in lib / assets / javascripts / lib.js I put:
//= require ./../sketchyPad/sketchyPad //= require_tree ./../sketchyPad/brushes //= require ./../sketchyPad/example/mattfarina-farbtastic-4bb6bbf/farbtastic.min
It seems to contain the correct files. Was there an easier way to do this?