我正在使用 Symfony 2 构建一个网站并使用 Less,就像这样
index.html.twig:
{% stylesheets
'@AcmeWebappBundle/Resources/public/css/website.less'
filter='?yui_css'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
配置.yml:
assetic:
filters:
lessphp:
file: %kernel.root_dir%/../vendor/lessphp/lessc.inc.php
apply_to: "\.less$"
现在文件website.less
增长了很多,所以我决定将它分成不同的文件,如下所示:
{% stylesheets
'@AcmeWebappBundle/Resources/public/css/mixins.less'
'@AcmeWebappBundle/Resources/public/css/general.less'
'@AcmeWebappBundle/Resources/public/css/tasks.less'
'@AcmeWebappBundle/Resources/public/css/notes.less'
filter='?yui_css'
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
该文件mixins.less
包含mixins
我在其他文件中使用的所有内容。
问题是,如果我在 中引用 mixin notes.less
,则无法识别 - 我相信这是因为 Assetic 仅在它正在编译的文件中搜索 mixin。顺便说一句,我使用的是lessphp,而不是node.js。
我该如何解决我的问题?如何使用 mixins.less 文件中声明的 mixins 拥有不同的 Less 文件?