如何从"resources"文件夹中包含js文件(Laravel 5.5) [英] How to include js file from 'resources' folder (Laravel 5.5)
问题描述
我用下一个代码包含了我的js文件
i used next code to include my js file
Meta::addJs('admin_js', '/resources/assets/admin_js/admin_app.js');
文件存在,但在控制台中我看到状态404.
File exists but in console i see status 404.
如果我将文件移动到公共"文件夹-一切正常.但我希望将此文件存储在资源"目录中
If i move file to 'public' folder - all ok. But i want that this file be stored in 'resources' directory
推荐答案
- 您必须将js文件移动到
public
或存储到storage
并进行符号链接. -
,或者您需要创建符号链接,将
resources
目录链接到public
目录(不推荐).
- you have to move js files to
public
or store intostorage
and make symlinks. or you need to create symlinks the
resources
directory to apublic
directory(which is not recommended).
您需要使用Laravel混合使用最推荐和有效的Laravel方法.请使用下面的链接阅读有关laravel混合解决方案的信息.
you need to use the most recommended and effective method of Laravel of using Laravel mix. Please use the link below to read about laravel mix a solution.
https://laravel.com/docs/5.6/mix
它将允许您将js
资产放置到resources
目录中,并在public
中制作压缩的js文件,供安装程序使用.
It will allow you to place your js
assets into resources
directory and make compressed js file in public
which will be used by the setup.
这篇关于如何从"resources"文件夹中包含js文件(Laravel 5.5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!