如何在 laravel 中更改值 appcss

How to change value appcss in laravel

我想更改 laravel 页面的背景颜色。根据我得到的参考。我应该在 _variables.scss.

中进行更改
// Body
$body-bg: #f8fafc; --> i change it to #000

// Typography
$font-family-sans-serif: "Nunito", sans-serif;
$font-size-base: 0.9rem;
$line-height-base: 1.6;
........

在视图文件中,我输入代码:

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>ICan</title>
    <link rel="stylesheet" href="/css/app.css"> --> i enter this one
  </head>
  <body>
    @yield('content')
    @include('inc.sidebar')
  </body>
</html>

然后我在 cmd 中执行 npm run serve 但是我的页面没有任何反应。背景颜色不变。我是不是做错了什么?

请帮助我。谢谢:))

你没有做错什么,只是少了一步。 在提供应用程序之前,请执行以下操作:

npm run dev

这会将您所有的 scss 文件编译到您的 app.css 文件中

但是,如果您不想在每次更改 scss 文件时都运行执行此命令,运行以下内容:

npm run watch

这将监视更改并运行 发生更改时进行编译!

你不需要 运行 npm run serve 或任何 npm 命令。

只需为您的自定义 css 添加另一个 css 文件,或者您可以直接在 blade.

中包含样式

你可以在 layouts > app.blade.php 中找到一个 blade 然后在关闭 head (</head>) 之前放置你的样式,就像这样:

   .container{
        background-color: lightblue;
    }

</head>

就是这样