【发布时间】:2014-11-09 23:13:26
【问题描述】:
我已经阅读了很多关于此的帖子,但无法使其适用于我的项目。
所以基本上我有一个 Symfony2 项目,其中包括 twitter bootstrap (v3)。在开发模式下一切正常,但是当我在 prod 模式下尝试时,我收到错误消息,提示找不到 twitter 引导字体:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/Symfony/css/fonts/glyphicons-halflings-regular.woff
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/Symfony/css/fonts/glyphicons-halflings-regular.ttf
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/Symfony/css/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular
这是正常的,因为我在 Symfony/ 中没有 css/ 文件夹
项目的结构如下:
app/
src/
vendor/
web/
css/
compiled/
fonts/
js/
树枝文件:
{% block stylesheets %}
{% stylesheets output="css/compiled/main.css" filter='cssrewrite'
'css/bootstrap.min.css'
'css/general.css'
'css/navigation.css'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
我用过:
php app/console assetic:dump --env=prod
我检查了 bootstrap.min.css(在 web/css/compiled 中)文件(prod 和 dev),它们都具有相同的字体路径。类似于 (../../../fonts/fontName.ext)。
如果我们查看路径,它在 dev 模式和 prod 模式下都不应该工作,因为路径将 fonts/ 文件放在 web 目录之外。然而,它可以在开发模式下工作。
关于如何解决这个问题的任何想法?
我会很高兴的。
【问题讨论】:
-
您可以尝试将
fonts目录移动到css目录吗? -
我已经试过了,但是没有用
-
您是否尝试删除“输出”属性? (为了排除一些相对路径问题)
标签: php twitter-bootstrap symfony assetic