I tried to install bootstrap4 via yarn. And I tried it like this:
But it didn't work out. How do I install bootstrap via yarn? Is it recommended to install bootstrap via yarn? Or is it a better practice to install bootstrap through the bootstrap gem?
Sorry nobody got back to you. I had some trouble doing this myself a while back. As Chris informed me, the webpacker and the asset pipeline are two totally seperate things with similar goals. You don't use them together.
The webpacker documentation may be the best place to look for tutorials. But as a TL;DR I would do the following:
yarn add [email protected]
app.sass... whichever name suits you best.)
bootstrap.sassimport your newly added boostrap library:
<%= stylesheet_pack_tag 'bootstrap' %>.
rails sin one terminal window tab and
./bin/webpack-dev-serverin the other so webpacker can compile your assets and serve them in your app.
Nice! I think it's worth noting now that with webpacker 3.0 you no longer need to run
./bin/webpack-dev-server unless you want features like hot module reloading.
rails s will also compile webpack assets.
Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.