doufei9946 2012-12-28 17:12
浏览 27
已采纳

Symfony2和Assetic - cssrewrite非常适合dev,而不适用于prod

I include my CSS with the following code:

{% stylesheets 'bundles/majorproductionssewingdivasite/css/*.css' filter='cssrewrite' %}
    <link rel="stylesheet" type="text/css" href="{{ asset_url }}" />
{% endstylesheets %}

In dev, this allows me to use image sprites without any problems. The resulting URL to my sprite is:

http://localhost/diva/web/bundles/majorproductionssewingdivasite/images/diva-sprites.jpg

But, in prod, it gets mapped to:

http://localhost/diva/bundles/majorproductionssewingdivasite/images/diva-sprites.jpg

Notice the lack of web directory.

The generated code in the CSS file is as it should be, and all my CSS (both the dev 'chunks' and the finalized prod assetic dump) are at web/css/. Any ideas as to why the prod environment is skipping the web directory?

EDIT: what's weird is that both dev and prod generate the same URL in the CSS itself:

url('../../bundles/majorproductionssewingdivasite/images/diva-sprites.jpg')

  • 写回答

4条回答 默认 最新

  • douyi8760 2012-12-28 17:50
    关注

    Solution is to dump the assets in the prod environment:

    $ app/console assetic:dump --env=prod
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题