javascript_include_tag Rails 4 generating “/javascripts/” instead of “/assets” in production

后端 未结 5 1794
野趣味
野趣味 2021-02-01 02:31

I have a Rails 4 application with

<%= javascript_include_tag \"modernizr\", \"data-turbolinks-track\" => true %>

in the head. In deve

5条回答
  •  情书的邮戳
    2021-02-01 03:20

    It may be because this file needs to be in /vendor/assets/javascript instead of /app/assets/javascript. The Vendor folder is for javascript libraries, and the App folder is for your code.

    A better solution than adding a tag to your layout would be adding a script reference to your application.js and let the sass compiler compress and attach it to your main javascript file.

    If you don't get a definitive answer, check out: http://guides.rubyonrails.org/asset_pipeline.html#asset-organization

提交回复
热议问题