Rails 6: How to add jquery-ui through webpacker?

后端 未结 8 943
失恋的感觉
失恋的感觉 2021-01-05 04:12

I\'m currently trying to implement a datepicker into my application, the problem is that there is no documentation on how to add the jquery-ui-rails gem through

8条回答
  •  独厮守ぢ
    2021-01-05 04:38

    Above steps works fine, removed extra steps

    The following steps worked for me to get jquery-ui working in Rails 6:

    1) On the terminal, inside your application type:
    yarn add jquery-ui-dist

    2) in app/javascript/packs/application.js
    require("jquery-ui-dist/jquery-ui");

    3) In the application.html.erb, include the jquery-ui theme

    <%= stylesheet_link_tag '//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/le-frog/jquery-ui.min.css' %>

    4) restart the rails server and webpack dev server.

提交回复
热议问题