Laravel 5.0文件夹结构:公共与资源 [英] Laravel 5.0 folder structure: public vs. resources

查看:57
本文介绍了Laravel 5.0文件夹结构:公共与资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Laravel 4.2中,我使用 public 文件夹来存储我所有的CSS,JS,图像和上传内容.目前,Laravel 5.0安装随附了一个新的 resources 文件夹,其中带有 assets 文件夹:

In Laravel 4.2, I used public folder to store all my CSS, JS, images and uploads. Currently, there's a new resources folder with assets folder in it coming with Laravel 5.0 installation:

/public
/资源/资产

/public
/resources/assets

这让我感到困惑,特别是因为资源还在其中包含视图.

This is confusing to me, especially because resources also holds views in it.

Via Laravel的升级指南(从4.2升级到5.0):

Via Laravel's upgrade guide (4.2 to 5.0):

从4.2应用程序的 public 目录到新应用程序的公共目录.

Copy your application's public assets from your 4.2 application's public directory to your new application's public directory.

并进一步:

您可以将Sass,Less或CoffeeScript移动到您的任何位置 希望. 资源/资产目录可能是很好的默认位置.

You may move your Sass, Less, or CoffeeScript to any location you wish. The resources/assets directory could be a good default location.

问题:Laravel 5.0文件夹结构中的 public resources 文件夹之间的实际区别是什么?

Question: What is the actual difference between public and resources folders in Laravel 5.0 folder structure?

推荐答案

此处的最大区别是public中的所有内容都是... 公开. resources不是.您在哪里放置什么都取决于您.

The big difference here is that everything in public is... well public. resources aren't. What you put in where is up to you.

通常,浏览器需要直接在公共目录中进行访问的所有内容.通常意味着:JavaScript,CSS,图像,也许还有一些视频或音频文件.

Generally you would have everything the browser needs to access directly in the public directory. Which usually means: JavaScript, CSS, images, maybe some videos or audio files.

resources/assets用于需要首先编译或缩小的内容.因此,在resources/assets中将有一些LESS或SASS文件,它们将被编译并缩小为一个放在public目录中的CSS文件.

resources/assets is meant for things that have to be compiled or minified first. So you would have a few LESS or SASS files in resources/assets and they would get compiled and minified into one CSS file that's put in the public directory.

这篇关于Laravel 5.0文件夹结构:公共与资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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