Rails beginner here. I want to use a few plugins (such as videoJS or jQuery UI) that contain both CSS and Javascript files in their downloads. I see that rails separates the two, putting JS in public/javascript and CSS in public/stylesheets.
Where should I put the files s开发者_Python百科o that I can keep the JS and CSS together, and how do I reference them?
You can put JS and CSS anywhere you want in public dir. For example: you have got videoJS plugin in public dir:
public
- stylesheets
- javascripts
- videoJS
- videojs.js
- videojs.css
- reset.css
- jquery.min.js
So now you just need to add this:
<%= stylesheet_link_tag '/videoJS/videojs', '/videoJS/reset' %>
<%= javascript_include_tag '/videoJS/videojs', '/videoJS/jquery.min' %>
精彩评论