diff options
author | nielslbeck <github.com@nielslbeck.com> | 2015-02-19 13:38:30 +0100 |
---|---|---|
committer | nielslbeck <github.com@nielslbeck.com> | 2015-02-19 13:38:30 +0100 |
commit | 2987fd14a2a5ca1be2668d322c0f2e79c4b2d642 (patch) | |
tree | 9d6764eea9c7153c6f276748fbde8bb2d74ef288 | |
parent | e75b25dae31813ed6de4b373476df78636ae3d16 (diff) |
Using strictMath
Using strictMath to prevent Less from trying to calculate stuff it's shouldn't calculate.
Example:
The following Less:
.small {
width: calc(~"100% / 12 * 6 - 40px");
}
will output the following CSS:
.small {
width: -webkit-calc(100% / 12 * 7 - 40px);
width: calc(100% / 12 * 7 - 40px);
}
which is as expected. The calculation can be performed at runtime.
But the minified version will be:
.small{width:-webkit-calc(18.33333333%);width:calc(18.33333333%)}
and that's something else (the absolute part, 40px, shouldn't be converted to something relative).
By using strictMath: true both the CSS and the minified CSS will contain the entire calculation.
-rw-r--r-- | Gruntfile.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Gruntfile.js b/Gruntfile.js index 247d3c40..c21bfeb6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -45,7 +45,8 @@ module.exports = function (grunt) { less: { dist: { options: { - compress: false + compress: false, + strictMath: true }, files: {} } |