如何从"resources"文件夹中包含js文件(Laravel 5.5) [英] How to include js file from 'resources' folder (Laravel 5.5)

查看:1219
本文介绍了如何从"resources"文件夹中包含js文件(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

推荐答案

  1. 您必须将js文件移动到public或存储到storage并进行符号链接.
  2. ,或者您需要创建符号链接,将resources目录链接到public目录(不推荐).

  1. you have to move js files to public or store into storage and make symlinks.
  2. or you need to create symlinks the resources directory to a public 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屋!

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