Rails asset pipeline: Standard way for including all /vendor/assets/javascripts/?

前端 未结 2 1430
生来不讨喜
生来不讨喜 2020-12-04 17:39

I\'ve been transitioning an app to Rails 3.1 (and now on to 3.2) and watched the Railscast on the asset pipeline. I moved all of my third-party jquery plugin files to the /v

相关标签:
2条回答
  • 2020-12-04 18:05

    I know it's an old question, but you can create a manifest file on the vender/assets/javascript folder:

     #vendor/assets/javascripts/my_jquery_plugins/manifest.js
     # require_tree .
    

    And in you application.js:

     //= require my_jquery_plugins/manifest.js
    

    If you're using Rails 4, name the manifest.js as index.js and in your application.js:

    //= require my_jquery_plugins
    

    It's less hacky than relative path described.

    0 讨论(0)
  • 2020-12-04 18:19

    You can add something like this in your app/assets/javascripts/application.js file to include all the vendor javascripts:

    //= require_tree ../../../vendor/assets/javascripts/.
    
    0 讨论(0)
提交回复
热议问题