Closed jasonfb closed 2 years ago
also with --css=bootstrap
I can't get any stimulus controllers to connect, even if I do add them using the rails stimulus:manifest:update
as explained in the index file..
whereas an app built without this gem (no --css=bootstrap
) the stimmy controllers seem to connect up just fine.
so. I guess my question is this:
is importmap designed to be used in conjunction with cssbundling-rails and/or jsbundling-rails or as an alternative?
What it seems to me is that these apps installed with cssbundling-rails and jsbundling-rails (which I believe happens if you use either the --css
or the --js
flag), you get a Rails default with no importmap and the the stimulus + Turbo gems installed, but then what happens is that Turbo + Stimulus don't actually work. unless I'm missing something obvious, I think there's just a piece missing to wire up stimulus and Turbo on these kinds of apps.
I think perhaps the answer to my question above is "as an alternative"
when I try to install importmap on top of apps created like this, things seem to get somewhat worse: two application.js files are created (one was already inside of contollers/
) and then Sprockets starts giving me errors:
Sprockets::DoubleLinkError in AdminDashboard::Users#index
Showing /Users/jason/Work/Hot_Glue/Example Apps/SimpleInvoicer/app/views/layouts/application.html.erb where line # raised:
Multiple files with the same output path cannot be linked ("application.js")
Note that I still get this even after I removed javascript_include_tag
out of my application erb file and only have javascript_importmap_tags
in this file.
I can't seem to retroactively fit importmap into these kinds of app at all, even trying to monkey patch the working (Default rails new) install into this non-functional install. So maybe this is the wrong route to go down. with these three new options it's just to see how the pieces fit together.
FYI — it the problem is on my machine it is almost certainly (I think?) the same root cause as https://github.com/rails/jsbundling-rails/issues/74
See my discussion with @dhh on that issue. Will get to the bottom of it soon-- I suspect cached yanked gems somewhere but if a 3rd party (who is not @dhh or me) could re-create on their machine to let us know what you get that would be helpful. all the details are over in the other story.
I guess the only relevant question here remains:
is importmap designed to be used in conjunction with cssbundling-rails and/or jsbundling-rails or as an alternative?
I was running these using rails s
which has no webpack so it's possible that was my problem here. nevertheless, the mystery about the inconsistent files at app/javascript/controllers/index.js
remains.
Since I was verbose above I will close this an re-file with only the question about the two app/javascript/controllers/index.js
files
Hey I just wanted to ask this query about starting with
--css=bootstrap
— it seems like when one does that (at least against 7.0.1), something else happens over in Stimulus (I know we're here in cssbundling-rails).In particular, I noticed that
javascript/controllers/index.js
has something different and interesting...it seems to suggest that this explicit registration pattern to update this file using
rails stimulus:manifest:update
is needed where as the other index.js file (at the same location) generated by the 7.0.1 without--css=bootsstrap
seems to do this other thing:just was curious if you could clarify the intention or maybe one is newer than the other? perhaps if the dynamic one is newer (seems smarter to me than a long list of registered controller names) it needs to be backported to the
--css=bootstrap
? or perhaps I'm missing something.Thank you @dhh !
-Jason