Symfony2 中用于 Twig 渲染的 CSS 个文件的路径

Path of CSS files in Symfony2 for Twig rendering

问题

我需要在页面呈现时生成 CSS 文件(每个用户的自定义颜色)。为了实现这一点,我做了一个动作来渲染文件并将路由作为参考,就像这样:

public function styleAction()
{
    $backgroundColor = $this->getUser()->getCompany()->getBackgroundColor();
    if(!$backgroundColor || $backgroundColor =="")
        $backgroundColor = '#b5dea2';

    $response = new Response();
    $response->setContent($this->render('*WHAT_TO_PUT_HERE*:style.css.twig',array('backgroundColor' => $backgroundColor)));
    $response->headers->set('Content-Type', 'text/css');
    return $response;
}

路线:

css_route:
    path: /css/mainStyle
    defaults: { _controller: AcmeMainBundle:Default:style }

问题: 为了访问位于 /web/css/style.css.twig.

下的文件,要写什么来代替 "WHAT_TO_PUT_HERE"

将文件放入您的 Bundles Resources\views 目录。