从应用程序目录安装资产 [英] Install assets from app directory
问题描述
这是我的目录结构
/app/Resources/public
/app/Resources/public/css
/app/Resources/public/iamges
/app/Resources/public/js
我需要将这些资产安装到/web 目录.正确的做法是什么?
我已经尝试过app/console install:assets
,但是它只能从捆绑软件中安装资产.可以在应用程序目录中存储全局资产吗?
I need to install these assets to /web directory. What is the right way to do it?
I've tried app/console install:assets
but it installs assets only from bundles. Is it possible to store global assets in app directory?
推荐答案
您的全局资产应直接放入Web文件夹.无需将它们放在app文件夹中,然后再复制它们!
Your global assets should go directly into the web folder. There is no need to put them in the app folder and then copy them!
install:assets
或assetic:dump
命令仅适用于属于一个捆绑软件的资产,并保留在该捆绑软件中以使其可重用.
The install:assets
or assetic:dump
command are for assets which belong to one bundle only and which are kept inside this bundle to make them reusable.
但是,您可以做的是将属于您应用程序的资产保留在应用程序捆绑包"中.大多数情况下,您至少获得了一个不可重用的软件包,它代表了您的应用程序核心.我将基本模板(base.html.twig
)和主要资产保存在其中,因此可以在它们上使用assetic:dump
!
What you can do though is to keep the assets which belong to your application in your "application bundle". Most of the time you got at least one bundle which is not reusable, representing your application core. I keep my base templates (base.html.twig
) and the main assets in there so I can use assetic:dump
on them!
这篇关于从应用程序目录安装资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!