Is yarn compatible with importmaps-rails in Rails 7?

Viewed 345

I just installed Rails 7 with bootstrap. It didn't come with import maps by default.

Can I use import maps with yarn, or should I stick to one method only?

Is there any compatibility issue I should be aware of?

If using both, what application.js would look like?

Thank you!

1 Answers

The Bootstrap css framework requires SASS and SASS is a Node module. When you specify that you want to use Bootstrap, your project is switched to a ESBuild one. It is not possible to have Importmap and Bootstrap in the same Rails 7.0.0 project.

Have a look on the following files:

  • bin/dev
  • Procfile.dev
  • package.json

At this time, the only CSS framework that does not require Node is Tailwindcss

Related