I created a new Rails 8 app with bootstrap css:
rails new my_app -c="bootstrap"
and Bootstrap worked out of the box. It created an application.bootstrap.scss file that included:
@import 'bootstrap/scss/bootstrap';
@import 'bootstrap-icons/font/bootstrap-icons';
I added:
$primary: #792c2c;
$theme-colors: (
'primary': $primary
);
and it did nothing. I tried stopping the server and running rails assets:precompile
but that also did nothing.
I created a new Rails 8 app with bootstrap css:
rails new my_app -c="bootstrap"
and Bootstrap worked out of the box. It created an application.bootstrap.scss file that included:
@import 'bootstrap/scss/bootstrap';
@import 'bootstrap-icons/font/bootstrap-icons';
I added:
$primary: #792c2c;
$theme-colors: (
'primary': $primary
);
and it did nothing. I tried stopping the server and running rails assets:precompile
but that also did nothing.
- 2 When you say "I added" where did you add it? I am assuming in the same file (although you didn't specify) but is it before or after you imported bootstrap (it should before). Docs – engineersmnky Commented Feb 3 at 18:08
- 1 Originally it was after. I changed it to before and it worked. Thanks @engineersmnky – Steve Schwedt Commented Feb 3 at 21:24
1 Answer
Reset to default 1Add the updated definition before the Bootstrap import:
$primary: #792c2c;
$theme-colors: (
'primary': $primary
);
@import 'bootstrap/scss/bootstrap';
@import 'bootstrap-icons/font/bootstrap-icons';