- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我使用 Symfony Flex 重新安装了 Symfony,新框架属于下一个 Symfony 4 目录结构。接下来,I'm going to override some resources例如来自外部包的模板、翻译等。
我已经尝试为模板创建所有这些路径(开始)但没有任何效果:
templates/EasyAdminBundle/views/...
templates/Resources/EasyAdminBundle/views/...
app/Resources/...
(只是旧结构的证明)我应该将我的资源文件放在哪里以覆盖第三方包资源?
最佳答案
对于所有 Symfony 版本,资源路径是 %kernel.root_dir%/Resources/
。由于新的4.0结构将Kernel.php
放到了src/
目录下,所以是:
# local resources directory
src/Resources/
# still works this path for local templates
src/Resources/views/
# override resources for third-party bundles
src/Resources/AcmeDemoBundle/views/ # legacy convention to override templates
src/Resources/AcmeDemoBundle/translations/ # for override both translations and validations files
src/Resources/AcmeDemoBundle/... # etc.
Twig Templates :只需遵循约定:
templates/bundles/AcmeDemoBundle/path/to/template.html.twig
If you are upgrading to Symfony 3.4 & 4.0 and you want to use the previous templates conventions, configure your own Twig's paths:
# app/config/config.yml (3.3)
twig:
paths:
# Default templates directory, since 3.4+
templates: ~
# Directory convention to override bundle templates, since 3.4+
# make sure to know the actual Twig namespace for each bundle.
# e.g. AcmeDemoBundle -> AcmeDemo:
templates/bundles/AcmeDemoBundle: AcmeDemo
Translations:与 templates/
类似,您在项目的根目录下有 translations/
目录(默认情况下):
translations/bundles/AcmeDemoBundle/messages.en.yml
注意:/bundles/AcmeDemoBundle/
子目录不是 是强制性的,因为翻译与包无关,而是与域相关。这意味着您可以覆盖翻译,只要它在正确的域中即可。
关于php - 如何覆盖 Symfony 4 中第三方包的资源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45239350/
我想知道是否有一种方法可以自动下载所有导入。因此,假设我需要在我的代码库中使用 github.com/gorilla/mux 和其他几个包。我应该手动转到我的 ~/go/src 并运行 go get
如果我添加第 3 方 bundle ,请说来自 Knp bundles例如,我应该先包装它还是应该直接在我的代码中使用它? 如果我决定包装它,我将包装代码放在哪里?在单独的新 bundle 中?在我的
我试图弄清楚这是否是我的设计中的错误,或者是 redis-py 库中的错误。本质上,我对 Python 中命名空间的理解是,包的设计应该使所有组件都位于包命名空间之下。意思是,如果我在 package
我是 Golang 的新手,在学习这门语言时一直采用 TDD 方法。我一直相处得很好,但我发现测试第三方包非常笨拙,这让我相信我一直在采取错误的方法。 我遇到麻烦的具体情况是模拟 Redis clie
我创建了 Angular 库 ( ngx-wig ),我想提供一种使用插件 来扩展其功能的能力。 在 Angular 中声明插件的最佳位置是什么? (可能类似于 myLibModule.forRoot
我一直在尝试找出如何将我自己的包添加为 kickstart 安装的一部分(特别是 mondo 包),但使用 %packages 指令而不是 post 脚本中的 rpm 命令。我尝试使用 kicksta
我正在尝试在 Node 中使用 d3(并且之前以某种方式成功地完成了?)。所以我就这么做了 npm install -g d3 效果很好。让我们检查一下: $ npm list -g d3 /usr/
美好的一天, 我目前是 webpack 中集成 vue.js 的新手。 基本上,我正在尝试使用已经安装在我的node_modules中的第3方软件包。 在此示例中,我安装了一个名为“Vuex Toas
我是一名优秀的程序员,十分优秀!