我使用Symfony2.0和MopaBootstrapBundle v2.x_sf2.0,它們提供Twitter-bootstrap。實際上,我包含了像documentation那樣的Less文件。該文件包含來自Twitter-bootstrap的所有Less文件。我的問題是我無法訪問其他文件中TwitterBootstrap提供的mixins。如何重用Twitter-bootstrap使用MopaBootstrapBundle提供的變量?
{% stylesheets filter='less
'@MopaBootstrapBundle/Resources/public/less/mopabootstrapbundle.less'
'@MyBundle/Resources/public/less/myfile.less'
%}
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
{% endstylesheets %}
這是解決這一問題的最佳方法是什麼?
在此先感謝。
我嘗試用你的解決方案來管理這個問題,但我還沒有成功導入文件。 我使用這個URL @import「/vendor/bundles/Mopa/BootstrapBundle/Resources/public/less/mopabootstrapbundle.less」;從MopaBootstrapBundle導入所有文件,並且從服務器沒有錯誤,所以我認爲路徑是正確的。 你知道什麼是錯的嗎? 謝謝 – gperriard
你已經給它提供了less文件的絕對路徑,記住在到達瀏覽器之前編譯的文件越少,所以你應該把它改成相對路徑'@import'../../../。 /../../../vendor/bundles/Mopa/BootstrapBundle/Resources/public/less/mopabootstrapbundle. less''。沒有測試,但應該工作。 – cvaldemar
我得到了500錯誤。我嘗試使用../../../../../../vendor/bundles/Mopa/BootstrapBundle/Resources/public/less/m opabootstrapbundle from/src/Btask/DashboardBundle/Resources/public/less/main.less – gperriard