SASS/CSS 没有用 react 和 bulma 完全修改

SASS/CSS not fully modified with react and bulma

我在我的 create-react-app 应用程序中集成了 bulma,但是当更改原色时,它并未应用于每个组件。

这是我App.jsx的return声明:

<section className="hero is-primary">
Some title
</section>
<section>
Some text
</section>

这是我的 index.scss:

@import '~bulma/bulma.sass';
$primary: $black;

body {
background-color: $primary;
}

事情是 "some text" 将有黑色背景,但 "some title" 将有默认的原色。不知道我错过了什么。我使用 node-sass.

正如上面的评论所述:如果您遇到同样的问题,您只需在导入库之前声明变量即可。当然,在这种情况下您将无法使用颜色变量,而是设置静态颜色值。