我已经阅读了很多关于这个的帖子,但是无法让这个用于我的项目.
所以基本上我有一个包含twitter bootstrap(v3)的Symfony2项目.在开发模式下,每件事都运行正常但是当我在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' %} {% endstylesheets %} {% endblock %}
我用了:
php app/console assetic:dump --env=prod
我已经检查了bootstrap.min.css(在web/css/compiled中)文件(prod和dev),它们都有相同的字体路径.像(../../../fonts/fontName.ext)这样的东西.
如果我们查看路径它不应该在开发模式或prod模式下工作,因为路径将字体/文件放在web目录之外.然而,它在开发模式下工作.
有关如何解决此问题的任何想法?
我会很高兴.