为css提供404资产

时间:2013-12-18 12:23:32

标签: php symfony assetic

我在普通php 中使用资产。我在css文件上得到404我在做什么错误

控制器

    require_once 'vendor/autoload.php';
    $loader = new Twig_Loader_Filesystem('backend/templates');
    $twig = new Twig_Environment($loader, array(
        //'cache' => 'backend/static/gen/templates',
    ));

    use Assetic\Factory\AssetFactory;
    use Assetic\Extension\Twig\AsseticExtension;
    use Assetic\FilterManager;
    use Assetic\Filter\LessFilter;

    $fm = new FilterManager();
    $fm->set('less', new LessFilter());

    $factory = new AssetFactory(dirname(__FILE__).'/backend/static/');
    $factory->setFilterManager($fm);
    $factory->setDebug(true);

    $twig->addExtension(new AsseticExtension($factory));


    echo $twig->render($current_template,$data);

查看

{% stylesheets '{{ STATIC_PATH }}less/bootstrap.less' filter='less' output='gen/all.css' %}
    <link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
{% endstylesheets %}

0 个答案:

没有答案