How to use Bootstrap, jQuery and other libraries in Rails 6 with Webpacker

27-Aug-2020 1739
Since Rails 6 , Webpacker has replaced the old assets pipeline (sprockets) to handle the javascript compilation and minification.Webpacker is a gem which is a wrapper for webpack.js, webpack.js handles bundling of javascript code, and webpacker lets us interface with webpack in our Rails app. This article won't go deep on how webpacker works, I recommend Prathamesh's article on understanding webpacker if you want to know more on how webpacker works. GoRails also have a great screencast on this topic.This article assumes you are starting a new Rails 6 project and want to use Bootstrap.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle