dpr81047 2013-10-05 11:37
浏览 76

Symfony2 / prod:未生成css和javascript文件名

After moving my symfony2 app to production, my homepage and and links related to the frontend part work fine (domain.com/event/xxxx, domain.com/category/yyy etc). CSS & JS are correctly loaded. However, my admin part which is accessible via domain.com/admin is not. When I check out the generated html, I find my CSS & JS filenames are null.

I am getting something like

<link rel="stylesheet" href="/css/.css"> 
<script src="/js/.js"></script>

I have cleared cache and dumped assetic :

./console cache:clear --env=prod --no-debug
./console assetic:dump --env=prod --no-debug

but nothing happens, the problem persists.

BTW, clearing the prod cache displays weird lines that do not show I clear the dev cache, I get some output like this :

Clearing the cache for the prod environment with debug false Mac OS X           2??ATTR?????j?
                                  com.apple.TextEncoding?_de.codingmonkeys.seestatemacintosh;0d1:pd1:yi85e1:wi1572e1:xi32e1:hi922ee1:sd1:pi1245e1:li0ee1:ei1e1:li1919e1:m16:SEEMode.PHP-HTMLeThis resource fork intentionally left blank   ??Mac O

If you need to see my config files, just tell me which files you need and I will paste them.

Any help please ?

EDIT

ok I don't know if this is correct or not, but I found this Assetic not creating combined links

and after changing $kernel = new AppKernel('prod', false);

by (the opposite of what is described in that link), it is working. $kernel = new AppKernel('prod', true);

Can I keep it like that ?

  • 写回答

1条回答 默认 最新

  • drgovyk64676 2014-12-22 20:36
    关注

    I've solved this with

    app/console cache:clear --env=prod --no-debug
    app/console cache:warmup --env=prod
    app/console assets:install --symlink
    app/console assetic:dump --env=prod --no-debug
    

    These commands helped me when the CSS was not loading. I always like to clear my caches whenever doing stuff like this. app/console assetic:dump --env=prod I think is the command that makes this work since it is the one that compiles the CSS and JS into one file.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化