Imagine we have Rails Engine blog
.
The engine's structure is:
blog
assets
javascripts
blog
master.js
application.js
controllers
...
helpers
...
application.js
is
//= require_tree .
master.js
holds some JavaScript code.
Also I have my application using this engine at /blog
.
My question is: How can I add some JavaScript code to engine from my application?
Solution is:
bundle.js will look like:
require_tree .
application.js will look like:
require blog/bundle
require_tree .
The problem was in name overlapping - application's bundle was overlapping engines one.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.