从应用程序目录安装资产

编程入门 行业动态 更新时间:2024-10-26 18:26:41
本文介绍了从应用程序目录安装资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是我的目录结构

/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!

更多推荐

从应用程序目录安装资产

本文发布于:2023-11-11 21:23:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579595.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   资产   目录

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!