本文介绍了从Zend Framework 2中的模块发布资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常建议将模块资产存储在模块目录内,moduleName/public内(或要命名资产目录的任何位置)内.

It is generally adviced to store module assets inside the module's directory, inside moduleName/public (or whatever you want to name the asset's directory).

Zend Framework 2默认情况下不支持模块资产的资产发布.根据 MWOP 的说法,大约1个月前没有任何计划,我想仍然没有真正的计划(他们可能需要做很多工作才能准备好稳定版). (但是,有一天,他们将解决这个问题.)

Zend Framework 2 unfortunately doesn't support asset publishing for module assets by default. According to MWOP, there was nothing planned ~1 month ago and I guess there still is no real plan (they had probably a lot of work to get the stable version ready). (But, some day, they are going to address this issue.)

随着我的ZF2应用不断发展,我达到了需要特定于模块的资产的地步.目前,我将它们维护在模块目录中,并将它们复制到应用程序的公共目录中.您可以想象这种方法容易出错并且很累人.

As my ZF2 app is growing and growing, I reached the point where I need to have module-specific assets. At the moment, I maintain them inside the module directories and copy them to the application's public directory. You can imagine that this method is error-prone and exhausting.

您如何处理此问题?可以通过很少的编码工作来解决此问题吗?我的项目计划不允许我自己创建复杂的资产处理.是否有与ZF2兼容的可推荐的轻型资产框架?我已经考虑过创建符号链接,但是我认为这不是最好的解决方案,因为它需要一些额外的Web服务器配置(FollowSymlinks)和额外的维护工作(该应用程序是在本地开发并部署在远程服务器上)

How do you handle this problem? Is there maybe a simple solution to this issue with little coding effort? My project plan doesn't allow me to create a complex asset handling on my own. Is there a recommendable, lightweight asset framework compatible to ZF2? I've already considered creating symlinks but I don't think this would be the best solution because it would require some additional web server configuration (FollowSymlinks) and additional maintenance work (the app is developed locally and deployed on a remote server).

谢谢.

推荐答案

之前已经在很多地方进行了讨论,可以归结为三种管理方法.

This has been discussed before in many places and it comes down to three ways to manage this.

  1. 将资产复制并粘贴到public/目录

  1. Copy and Paste the assets into the public/ directory

使用符号链接

使用资产加载模块,例如资产

Use an asset loading module like assetic

一个简单的解决方案是使资产复制成为构建过程的一部分.

A simple solution would be to make the copying of assets part of you build process.

已经问了另一个问题如何合并Zend Framework 2模块公共目录以获取信息.

Another question was already asked How to merge Zend Framework 2 module public directories for info.

这篇关于从Zend Framework 2中的模块发布资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 19:48