Rails 4 assets.precompile

前端 未结 2 1009
别那么骄傲
别那么骄傲 2021-02-05 19:25

This is a common question in here, but none of the solutions fixed my problem, so here it goes:

I am adding ace.js to my rails4 app, So what I did was

-         


        
2条回答
  •  醉梦人生
    2021-02-05 20:19

    In case you are adding the ace directory as an assets , you should place the js files under vendor/assets/ace/javascripts directory (which you should create) .

    Normally you don't need config.assets.precompile += %w( index.js ), Sprockets will manage it just fine. If there is just one js file to add from vendors/assets/ace directory , you don't need an index.js there . The index.js would be proper if you have a lot of subdirectories and files under vendor/assets/ace/javascripts/your_vendor_js_library . One last touch : you don't need <%= javascript_include_tag "ace" %> , it duplicates <%= javascript_include_tag "application" %>'s content.

提交回复
热议问题