[英]should I use assets folder or public folder? laravel 5.3
Using Laravel 5.3 使用Laravel 5.3
I realized now the view files are under a folder called resources
and there's an assets
folder which has js
folder in it. 我意识到现在视图文件位于一个名为resources
的文件夹下,并且有一个assets
文件夹,其中包含js
文件夹。 public
folder still exists public
文件夹仍然存在
I have read a few other posts saying it's up to you either I want to put my js
or css
under public
or assets
我读过其他几篇文章说,由我决定将我的js
或css
置于public
或assets
之下
I also know that when using gulp
files are directed under public
which is changeable. 我也知道,在使用gulp
文件时,这些文件是在可更改的public
下定向的。
I am wondering if I put my files under the assets
then compile under public
do I have to run the compile each time when I test my scripts? 我想知道是否将文件放在assets
然后在public
下编译吗?每次测试脚本时都必须运行编译吗? If not, what should I put as the src
in my html? 如果没有,我应该把什么作为src
放在我的html中?
You should put it in your public folder. 您应该将其放在公用文件夹中。 If you use URL::asset('path/to/file')
it will return [...]app/public/path/to/file and not the resources path as well. 如果您使用URL::asset('path/to/file')
,它将返回app / public / path / to / file,而不是资源路径。
The resources folder you mentioned is more for raw assets like SASS, LESS, etc. 您提到的资源文件夹更多地用于原始资产,例如SASS,LESS等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.