duangai1368 2017-05-23 20:44
浏览 63
已采纳

Symfony和Assetic的CSS路径在哪里?

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

I've tried using Assetic within Symfony 3 to fetch CSS files. However, despite looking in Symfony's documentation, I have no idea where this 'bundles/app/css/*' actually is within Symfony. I've tried putting a css file in /app/css/ but no css files seem to load on load.

  • 写回答

1条回答 默认 最新

  • dtf1111 2017-05-23 22:16
    关注

    bundles/app/css/ is in your web directory.

    The goal of assetic's is that you keep your assetic's files together with all other files in your bundle where they belong to. The problem is that the src/AppBundle directory (there where your bundle content can be found) should not be accessible from the web while assets need to be accessible from the web. For that reason you can store (and edit) your assets in the src/AppBundle/Resources/public directory and when you are done you can copy them to the web directory from the cli with this command:

    php bin/console assets:install

    In the src/AppBundle/Resources/public directory you should create sub-directories like css, js, images and fonts. i.e. src/AppBundle/Resources/public/css

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动