Skip to content

Instantly share code, notes, and snippets.

@frullah
Last active October 27, 2021 06:44
Show Gist options
  • Save frullah/9ef68596ab2934892c6d29b66086c879 to your computer and use it in GitHub Desktop.
Save frullah/9ef68596ab2934892c6d29b66086c879 to your computer and use it in GitHub Desktop.
using Rails activeadmin with Vite bundler
// required dependencies
// - jquery
// - jquery-ui
// - @activeadmin/activeadmin
import jQuery from 'jquery'
window.jQuery = jQuery
window.$ = jQuery
;(async function () {
await import('jquery-ui')
await import('jquery-ui/ui/widgets/mouse')
await import('jquery-ui/ui/widgets/button')
await import('jquery-ui/ui/widgets/menu')
await import('jquery-ui/ui/data')
await import('jquery-ui/ui/disable-selection')
await import('jquery-ui/ui/focusable')
await import('jquery-ui/ui/form')
await import('jquery-ui/ui/ie')
await import('jquery-ui/ui/keycode')
await import('jquery-ui/ui/position')
await import('jquery-ui/ui/labels')
await import('jquery-ui/ui/jquery-patch.js')
await import('jquery-ui/ui/plugin')
await import('jquery-ui/ui/safe-active-element')
await import('jquery-ui/ui/safe-blur')
await import('jquery-ui/ui/scroll-parent')
await import('jquery-ui/ui/tabbable')
await import('jquery-ui/ui/unique-id')
await import("@activeadmin/activeadmin");
})()
# in your Application Helper
module ApplicationHelper
def stylesheet_pack_tag(style, **options)
style = style.sub(/\.css$/, '.scss')
vite_stylesheet_tag(style, **options)
end
def javascript_pack_tag(style, **options)
vite_javascript_tag(style, **options)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment