2

I just created a rails plugin with "rails plugin new pluginname --mountable".

Now I would like my app in test/dummy to access the js and css in my app/assets/javascripts and app/assets/stylesheets directories... I would like this process to be "automatic"(so no copy/paste of files from these directories to my test/dummy...) because I would like to release this plugin for people to use it and it should be as much easy to use as possible.

Thank you in advance for your help

Gnagno

1 Answer 1

1

The asset pipeline will find any asset that is inside of an engine. If you have a file app/assets/javascripts/foo.js and in your host application's application.js has:

//= require foo

It will include your asset in the combined application.js.

If you want to automatically include your file you will have to add to config.action_view.javascript_expansions[:defaults] but this was replaced with using comment requires in the asset pipeline.

Sign up to request clarification or add additional context in comments.

1 Comment

isn't it possible to make some configuration at plugin level so that the js and css from the plugin will be included in every page of the hosting application?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.