开发者

Rails: How to import JS/CSS from "vendor/plugins/" directory?

I would like to use the jQuery UI Datepicker plugin in my Rails 3 application.

I thought to put it in vendor开发者_开发百科/plugins/ directory. (Is there a better place ?)

I tried to import the JS file like that:

<%= javascript_include_tag '/vendor/plugins/jquery-ui-1.8.9-datepicker/js/jquery-ui-1.8.9.custom.min.js' %>

but it does not recognize the path.

How should I do this ?


To serve the javascripts, they will need to be placed in public/

If you place the file itself in public/javascripts/ it can be referenced with:

<%= javascript_include_tag 'jquery-ui-1.8.9.custom.min.js' %>

Don't forget to include Jquery and JqueryUI javascripts for this JS plugin to work.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜