Twitter Bootstrap: Error compiling mixins.less with lessphp

If you are trying to compile Twitter Boostrap v2.3 CSS using less and lessphp v0.3.8 you have probably faced a “500 Internal Server Error” message.

It is due to a bug on lessphp side. Bootstrap uses less.js and does not support lessphp.

To fix the problem you will need to open mixins.less file and make a change on the following 6 lines.

mixins.less original file

.span@{index} { .span(@index); } // line:578
.offset@{index} { .offset(@index); } // line:584
.span@{index} { .span(@index); } // line:623
.offset@{index} { .offset(@index); } // line:629
.offset@{index}:first-child { .offsetFirstChild(@index); } // line:630
input.span@{index}, textarea.span@{index}, .uneditable-input.span@{index} { .span(@index); } // line:678

mixins.less fixed

(~".span@{index}") { .span(@index); } // line:578
(~".offset@{index}") { .offset(@index); } // line:584
(~".span@{index}") { .span(@index); } // line:623
(~'.offset@{index}') { .offset(@index); } // line:629
(~'.offset@{index}:first-child') { .offsetFirstChild(@index); } // line:630
(~"input.span@{index}, textarea.span@{index}, .uneditable-input.span@{index}") { .span(@index); } // line:678

Sources