Rails 6, Bootstrap 5 & BS icons

Public
Rails 6, Bootstrap 5 & BS icons
Icons/chart bar
Used 14 times
Created by
Z Z N

Usage
  • Adds Bootstrap 5;
  • Bootstrap icons;
  • Doesn't add jQuery

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/Xg8s2l"
Template Source

Review the code before running this template on your machine.

def yarn(*packages)
  run("yarn add #{packages.join(" ")}")
end

yarn 'bootstrap', '@popperjs/core', 'bootstrap-icons'

file 'app/javascript/stylesheets/application.scss', <<-CODE
  @import 'bootstrap';
CODE
  
inject_into_file 'app/javascript/packs/application.js' do <<~EOF

  import 'bootstrap';
  import '../stylesheets/application';
  import 'bootstrap-icons/font/bootstrap-icons.css'
  EOF
end
Comments

Sign up or Login to leave a comment.