Linus
Linus

Reputation: 2819

Include assets in engine from main application

I have created an admin interface as a Rails engine. In the project I work in at the moment I need to add some custom javascript. I want to keep this in my main app and not add it in my engine.

Perhaps register some javascript or stylesheet files in a config file and let the engine include them.

Any ideas on how I can achieve this?

Upvotes: 0

Views: 114

Answers (1)

phoet
phoet

Reputation: 18845

you are asking about ideas, so here is one: just use a convention!

it's common to do this in rails, so why not just do it for your engine. just document how to name the files and what to configure for that (assets need to be configured differently when they should not be included in application.js/css). the admin interface typus does the same thing: http://docs.typuscmf.com/customization/custom_css_and_js.html

in your engine, you can just check if that file is present in the mounting app and include it in that case.

should be pretty straight forward.

Upvotes: 1

Related Questions