-
Notifications
You must be signed in to change notification settings - Fork 62
Make generators compatible with importmaps #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| when "motion" | ||
| pin_motion | ||
| when "tippy.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two packages didn't play well with importmaps, so I'm pointing to remote cdn. My first take was to download the file and add to vendor/javascript folder and add pin "motion" to config/importmap.rb, but I'm not sure if that was the best option, because it could go wrong if user tried to update/redownload the packages. If think it's safer to point to CDN and let the users download the file if they want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephannv , this is fine. Tippy.js will be replaced by floating-ui, and motion is used on the Accordion, but I don't think we need any dependency there. In other words, it's fine, and we should remove both dependencies soon.
| if File.exist?(Rails.root.join("tailwind.config.js")) # tailwindcss js package | ||
| template "tailwind.config.js.js-package.erb", Rails.root.join("tailwind.config.js") | ||
| elsif File.exist?(Rails.root.join("config/tailwind.config.js")) # tailwindcss-rails gem | ||
| template "tailwind.config.js.tailwindcss-rails.erb", Rails.root.join("config/tailwind.config.js") | ||
| else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rails apps using importmaps use tailwindcss-rails gem, the config file is located on config folder and uses a slightly different file content but I think it was enough to create 2 separated templates, I think it was easier than trying inject pieces of code conditionally.
cirdes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great!!
| when "motion" | ||
| pin_motion | ||
| when "tippy.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephannv , this is fine. Tippy.js will be replaced by floating-ui, and motion is used on the Accordion, but I don't think we need any dependency there. In other words, it's fine, and we should remove both dependencies soon.
Make generators compatible with importmaps. Some js packages I had to point to jsdelivr +esm because using
bin/importmap pin motionwould download the wrong file and get a lot of errors. I'm not sure if there is a way to use correct file usingpincommand.ps. Using this branch I could generate a Rails app from scratch and I could use RubyUI components (+ their javascripts) using only our generators.