【发布时间】:2017-07-05 09:10:29
【问题描述】:
仍在学习 Symfony。 我有一个基于引导程序的通用主题,用于我们的应用程序。 这个主题包含 javascripts、less/css 文件、图像和字体。
我正在使用assetic,我正在尝试找出将这个主题包含在应用程序中的最佳实践。
我应该将所有文件放在 app\Resources\public 的子文件夹中吗?
app/Resources/public/mytheme
app/Resources/public/mytheme/css
app/Resources/public/mytheme/js
app/Resources/public/mytheme/images
但是,特别是对于图像,我必须通过类似的方式引用 twig 中的文件
{% image '../app/Resources/public/mytheme/images/user/no-image.png' output="images/user/no-image.png"%}
<img src="{{ asset_url }}" alt="Example"/>
{% endimage %}
它不会通过使用安装任何符号链接或资产
php bin/console asset:install --symlink
在 css 中,我有一个“.logo”类,它引用了“app/Resources/public/mytheme/images/theme-logo.png”,即使使用 cssrewrite 过滤器,在 html 中也会导致链接断开.
我应该创建一个包含所有资产的 MyThemeBundle 吗?或者我应该将所有资产放在 web/mytheme 文件夹中(但所有资产都将是公开的,甚至更少的文件)?
我有点困惑。
【问题讨论】:
标签: symfony theming symfony-3.3