Mix清单不存在时不存在 [英] The Mix manifest does not exist when it does exist

查看:131
本文介绍了Mix清单不存在时不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于管理面板,我提取了包括manifest-json.jsmix.setPublicPath(path.normalize('public/backend/'))在内的所有资产.

For my admin panel I extract all the assets including the manifest-json.js to mix.setPublicPath(path.normalize('public/backend/')).

所有文件都已正确添加到后端文件夹,并且manifest-json.js文件如下所示:

All the files get correctly added to the backend folder, and the manifest-json.js file looks as follows:

{
    // all correct here
    "/js/vendor.js": "/js/vendor.js",
    "/js/app.js": "/js/app.js",
    "/css/app.css": "/css/app.css",
    "/js/manifest.js": "/js/manifest.js"
}

问题在于,使用

{{ mix('backend/css/app.css') }}

在我的刀片文件中,它在public/manifest-json.js中查找,而不是在backend/manifest-json.js中查找.

in my blade-files, it looks in public/manifest-json.js instead of looking for it in backend/manifest-json.js.

如何确保使用正确的manifest-json.js文件?

How can I make sure the right manifest-json.js file is used?

推荐答案

我遇到的问题是,默认情况下mix() -helper函数在/public/manifest-json.js中查找manifest-json文件,因此,如果将该文件存储在任何其他目录级别,它将引发该错误.

The problem I faced was that the mix()-helper function by default looks for the manifest-json file in /public/manifest-json.js so if you store that file on any other directory level then it will throw that error.

假设manifest-json文件存储在public/app/manifest-json.js中,那么对于位于public/app/css/app.css中的文件,您将使用:

Let's say the manifest-json file is stored in public/app/manifest-json.js, then for a file located in public/app/css/app.css you would use:

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

mix() -helper函数允许使用第二个参数,即清单文件的目录.只需在此处指定它,它将使用正确的清单文件.

The mix()-helper function allows for a second argument, the directory of the manifest file. Just specify it there and it will use the correct manifest file.

这篇关于Mix清单不存在时不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆