配置:
assetic:
debug: %kernel.debug%
use_controller: false
read_from: %kernel.root_dir%/../public
filters:
less:
node: /usr/bin/node
node_paths: [/usr/local/lib/node_modules]
Twig模板:
{% block stylesheets %}
{% stylesheets filter='less'
'@MyBundle/Resources/public/bootstrap/less/bootstrap.less'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
这个几乎很好用。
我有一个问题,就是没有图片,它们被引用为相对路径("../img/glyphicons-halflings.png")但是它们并不存在。
还有一个问题,如果我在生产服务器上没有node.js,那么它能正常工作吗?如果我只上传已编译的css文件,会起作用吗?
cssrewrite: ~
就可以启用它。 - greg0ireurl("../Resources/public/bootstrap/img/glyphicons-halflings.png")
引用它,这是一个好的方向,但仍然是404。谢谢。 - umpirsky