【问题标题】:I cannot load the .js file and .css when using blade template in lavarel [duplicate]在 laravel 中使用刀片模板时,我无法加载 .js 文件和 .css [重复]
【发布时间】:2020-01-08 02:19:52
【问题描述】:

我已经安装了我的代码如下

PHP 7,我使用 Lavarel 框架 5x。

@extends('welcome')
@section('content')

      <h2>Test</h2>
@endsection

<div class="col-sm-9 padding-right">
                @yield('content')
 </div>

【问题讨论】:

标签: php laravel


【解决方案1】:

感谢您的支持,我通过编辑css链接修复了它:

<link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css">

【讨论】:

    【解决方案2】:

    确保您已将 css 包含在 head 中

    <link href="{{ mix('css/app.css') }}" rel="stylesheet" type="text/css">
    

    js 是你体内的最后一个

    <script src="{{ mix('js/app.js') }}"></script>
    

    【讨论】:

    • 使用 mix 函数时,我得到一个 ErrorException (E_ERROR) The Mix manifest does not exist.
    • 这是你刚开始的项目吗?你打算写sass然后用mix编译还是直接在public/css中写css? npm installnpm run dev 可以解决这个问题,但我不知道这是否是你想要的
    • 如果您不混淆文件,请使用asset('js/app.js') 而不是mix
    猜你喜欢
    • 2021-11-27
    • 2018-08-11
    • 1970-01-01
    • 2015-05-21
    • 1970-01-01
    • 2021-05-11
    • 2020-11-21
    • 1970-01-01
    • 2013-10-13
    相关资源
    最近更新 更多