Search code examples
twitter-bootstrap-3lesscodekit

How to run Bootstrap 3.0.2 with newer versions of Less?


PROBLEM

We have a site on Bootstrap 3.0.2 which won't compile in Codekit, it fails on things like:

floor(@grid-gutter-width / 2);

I'm guessing Less has changed but after searching, I can't figure how it's changed. Pages I've been combing through:

https://bootstrapdocs.com/v3.0.2/docs/getting-started/

https://github.com/twbs/bootstrap/releases?after=v3.1.0

https://github.com/less/less.js/blob/master/CHANGELOG.md


QUESTIONS

  1. In general, what's the best way of handling this without breaking everything?

  2. Does anyone know which Less changes are causing the compile errors?

  3. Is there a version of Bootstrap 3 that works with newer Less versions?

  4. Or would I have to somehow run an older version of Less inside Codekit?

Any pointers in the right direction would be much appreciated.


Solution

  • The issue was a change in Less 1.4.0 Beta 1 & 2 (2013-03-07)

    maths is now only done inside brackets. This means font: statements, media queries and the calc function can use a simpler format without being escaped. Disable this with --strict-maths-off in lessc and strictMaths:false in JavaScript.

    You can use the --strict-maths-off flag but I decided to plug in Bootstrap v3.3.7 and update the theme to support the newer Bootstrap (and less).