开发者

Include css and js from an engine to a rails app created with rails plugin new

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜