Laravel 中的 运行 样式和脚本

Styles and scripts not running in Laravel

我在这样的 view.blade.php 中导入样式和脚本

但是我运行项目的时候,none这些样式是运行ning:

我的来源:

这个项目运行在其他计算机上运行良好。

如果您的 css 在以下目录中:

/public/css/blog-home.css

您可以尝试以下方法:

<link rel="stylesheet" type="text/css" href="/css/blog-home.css">

阅读:https://laravel.com/docs/5.5/mix

只需将您的样式表引用到 public 文件夹 public/css/style。css

<link rel="stylesheet" type="text/css" href="/css/style.css"> 

如果您有多个样式表并想混合使用它们 运行 laravel 混合

mix.styles([
    'public/css/vendor/style.css',
    'public/css/vendor/fontrian.css' //and other style sheets
], 'public/css/all.css');

npm run dev 

这会自动将您所有的 css 编译到 public 文件夹。