Skip to content

Add Bootstrap icons as (optional) task #63

@viktorianer

Description

@viktorianer

It took me 2 days to figure out, how to use this gem with bootstrap icons. Frustrating thing!

I would suggest adding a task to this gem, which helps start with Bootstrap 5 and Bootstrap Icons as quickly as possible.

Steps you need to add bootstrap-icons to a new app, created with rails new sample_app --javascript esbuild --css bootstrap.

# Add Bootstrap icons
say "Add Bootstrap icons"
run yarn add bootstrap-icons

append_file "app/assets/stylesheets/application.bootstrap.scss" do
  <<~SCSS 
  @import 'bootstrap-icons/font/bootstrap-icons';
  SCSS
end

inject_into_file "config/initializers/assets.rb", after: /.*Rails.application.config.assets.paths.*\n/ do
  Rails.application.config.assets.paths << Rails.root.join("node_modules/bootstrap-icons/font")
end

I think I can add the steps on this task, but if we need more, I need some help.
Maybe it's better to add another installer?!

What do you think?
What about documentation?

Many thanks to Junichi Ito on StackOverflow
https://stackoverflow.com/questions/70526113/how-to-use-bootstrap-icons-with-rails-7-0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions