rootstrap / htmx-rails

The easiest way to work with HTMX in your Rails app
https://www.rootstrap.com/
MIT License
117 stars 5 forks source link

Followed README but getting error #8

Closed josebalius closed 1 year ago

josebalius commented 1 year ago
couldn't find file 'htmx' with type 'application/javascript'

Followed readme instructions, ran the generator but getting the error above. Generator showed:

❯ rails g htmx:install
      append  app/assets/javascripts/application.js

using rails 7

megatux commented 1 year ago

Hello @josebalius. I think the issue is related to the use of importmaps in Rails 7 default setup. I'm working on a PR to fix it.

megatux commented 1 year ago

The PR is having some issues in the CI with jruby but in the meantime @josebalius you can try it if you want. I did a small htmx test w/Rails 7.1 app and seems to work fine.

psycho-baller commented 1 year ago

I am using bun and have the same issue btw

megatux commented 1 year ago

@josebalius the #9 was merged to fix this issue. Would be great if you could try it again. Thanks

megatux commented 1 year ago

@psycho-baller the #9 was merged to fix this issue just for importmaps. I'll create a new issue just for adding support for bun. I was already researching it and seems doable. BTW, could help me if you have some repo with a Rails+bun example. Regards

megatux commented 1 year ago

Closed as fixed with #9 (importmaps scenario)

psycho-baller commented 1 year ago

@megatux Here's thie simple repo I made with bun

megatux commented 12 months ago

Thanks @psycho-baller, I ran your app and the generator with some changes I did on this #12 PR branch. Seems to work here with a basic htmx test.

If you want to try it you can use the branch with this in your Gemfile

gem 'htmx-rails', :github => 'rootstrap/htmx-rails', :branch => 'issue-10__add_bun_support'

or wait till the PR is reviewed and merged. Regards!