Rails 4: Where to put JavaScript/CSS plugins

前端 未结 3 597
执念已碎
执念已碎 2021-01-20 03:40

I have Rails 4rc1 application. I need to integrate some JavaScript / CSS plugins / 3rd party libraries/ to my application. I know vendor/plugins directories are deprecated i

3条回答
  •  再見小時候
    2021-01-20 04:13

    It sounds like you may be asking about third-party javascripts & CSS - not Rails plugins. I prefer to put my third-party scripts under vendor/assets, like so:

    RAILS_ROOT
      \- vendor
        \- assets
          \- javascripts
           - stylesheets
    

    Then you can access them in your application.* files like this:

    // application.js
    //= require_tree vendor/javascripts
    
    /* application.css */
    *= require vendor
    

提交回复
热议问题