Laravel资产链接不​​起作用

时间:2017-02-07 10:49:19

标签: html laravel

我想在Laravel中安装“Metronic”管理主题,因此将标题中的链接调整为正确的路径。

当前标题如下所示:

<head>
    <meta charset="utf-8" />
    <title>Metronic Admin Theme #1 | Blank Page Layout</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <meta content="Preview page of Metronic Admin Theme #1 for blank page layout" name="description" />
    <meta content="" name="author" />
    <!-- BEGIN GLOBAL MANDATORY STYLES -->
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
    <link href="../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
    <link href="../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
    <!-- END GLOBAL MANDATORY STYLES -->
    <!-- BEGIN THEME GLOBAL STYLES -->
    <link href="../assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
    <link href="../assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
    <!-- END THEME GLOBAL STYLES -->
    <!-- BEGIN THEME LAYOUT STYLES -->
    <link href="../assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
    <link href="../assets/layouts/layout/css/themes/darkblue.min.css" rel="stylesheet" type="text/css" id="style_color" />
    <link href="../assets/layouts/layout/css/custom.min.css" rel="stylesheet" type="text/css" />
    <!-- END THEME LAYOUT STYLES -->
    <link rel="shortcut icon" href="favicon.ico" /> </head>
<!-- END HEAD -->

我将所有需要的文件夹复制到resources/assets/文件夹中,但是在加载页面时仍然找不到它,无论我如何更改未找到的路径。我该如何正确调整?

3 个答案:

答案 0 :(得分:1)

  

您可以使用{{asset}},它允许您链接到其中的资产   你的公共目录

尝试

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

https://laravel.com/docs/5.4/helpers#method-asset

答案 1 :(得分:0)

Metronic 主题的assets文件夹复制到您应用的public文件夹中。按以下行添加资源链接:

 <link href="/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

答案 2 :(得分:0)

通过 Metronic,您可能忘记打电话了

npm run dev 

npm run prod

根据文档 Metronic Laravel