【问题标题】:Symfony templates - including cssSymfony 模板 - 包括 css
【发布时间】:2013-08-27 08:52:15
【问题描述】:

我有一个简单的问题。

我是第一次使用 Symfony,遇到了包括我的 CSS 在内的问题。

在我的 app\Resources\views\master.html.twig 我有:

 <link rel='stylesheet' type='text/css' href='{{ asset('/css/huraga-green.css') }}'>

我不能让它工作,它实际上会生成:

 <link rel="stylesheet" type="text/css" href="/css/xy.css">

指向:

 http://localhost/css/xy.css

问题是,我正在使用 easyPHP,但我在这条路线上没有任何东西,我的 Symfony 项目的根目录在:

C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\projects\symfony\

就像我说的,我是 Symfony 的新手,所以任何帮助都将不胜感激 :)

TNx 很多!

【问题讨论】:

标签: php css templates symfony twig


【解决方案1】:

来自 Symfony 文档:http://symfony.com/doc/current/cookbook/assetic/asset_management.html#including-css-stylesheets

包括 CSS 样式表
要引入 CSS 样式表,您可以使用上面解释的相同技术,除了样式表标签:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-25
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    • 2011-01-20
    • 1970-01-01
    • 2019-08-04
    相关资源
    最近更新 更多