9
我想在編譯前重載一些引導LESS變量,例如:@import後覆蓋Bootstrap LESS變量
// Core variables
@import "variables.less";
// Trying to override @white from variables.less
@white: #de1de1;
// other bootstrap @imports....
上面的代碼不會覆蓋@white
,但如果我在variables.less文件的末尾添加@white
,它工作正常。
看來變量只能被覆蓋在同一個文件中。但是這對我來說沒有意義,因爲我認爲LESS沒有那樣工作。例如,其他@import
文件(從上面的代碼中省略)使用@white
變量。如果他們能夠在variables.less文件之外使用它,爲什麼我不能在文件外部覆蓋它?
我使用Less Php 0.3.9來編譯我的代碼。
注: 我只是嘗試了下面的代碼:
// Core variables
@import "variables.less";
@import "variables-custom.less";
現在的@white
值從變量 - custom.less(這在一定程度解決了我的問題)採取。它仍然不能解釋爲什麼我的原始代碼不起作用。將欣賞答案。
對此有一個很好的答案http://stackoverflow.com/questions/15426256/override-less-variables – ScottS 2013-03-15 13:19:19