资产,叽叽喳喳bootstrap和更less
configuration:
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]
枝杈模板:
{% block stylesheets %} {% stylesheets filter='less' '@MyBundle/Resources/public/bootstrap/less/bootstrap.less' %} <link rel="stylesheet" href="{{ asset_url }}" /> {% endstylesheets %} {% endblock %}
这工作几乎好。
我有一个问题,没有图像,他们被引用相对url(“../ img / glyphicons-halflings.png”),但他们不在那里。
还有一个问题,它适用于node.js,但是如果我在生产服务器上没有node.js,如果我只上传编译后的css,它会起作用吗?
我想你也应该使用cssrewritefilter,像这样:
{% block stylesheets %} {% stylesheets filter='less,cssrewrite' '/bundles/mybundle/bootstrap/less/bootstrap.less' %} <link rel="stylesheet" href="{{ asset_url }}" /> {% endstylesheets %} {% endblock %}
不要忘记用这个命令发布你的资产:
app/console assets:install --symlink web
为了回答你的最后一个问题,是的,上传编译的CSS将会有所斩获。