最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

sass - Custom Bootstrap color theme with Rails 8 - Stack Overflow

programmeradmin0浏览0评论

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.

Share Improve this question asked Feb 3 at 17:22 Steve SchwedtSteve Schwedt 4203 silver badges14 bronze badges 2
  • 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
Add a comment  | 

1 Answer 1

Reset to default 1

Add the updated definition before the Bootstrap import:

$primary: #792c2c;

$theme-colors: (
  'primary': $primary
);

@import 'bootstrap/scss/bootstrap';
@import 'bootstrap-icons/font/bootstrap-icons';
发布评论

评论列表(0)

  1. 暂无评论