Rails 4 assets.precompile

前端 未结 2 1005
别那么骄傲
别那么骄傲 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.

    0 讨论(0)
  • 2021-02-05 20:23

    It is solved by adding :

    config.assets.precompile += %w( index.js )
    

    to config/application.rb. (not config/environments/production.rb)

    Tested in Rails 4.0 beta1.

    0 讨论(0)
提交回复
热议问题