Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to change precision in node-sass / libsass

Tags:

node.js

sass

I'm currently using grunt-sass with the node-sass wrapper for libsass. Is there anyway to change the precision when rounding floating point numbers?? I know it can be changed in ruby sass, but cannot find anyway of changing it in libsass.

It currently rounds to 5, but if I need to give a line-height which is a recurring number i.e 1.33333 I get minor discrepancies in how it translates to pixels on the screen. Having it round to 7 places fixes this.

If anyone has managed to change this please let me know.

Thanks in advance

like image 862
James Avatar asked Dec 28 '13 17:12

James


2 Answers

As of now there seems to be official support for specifying a precision in node-sass.

Since grunt-sass simply passes most of the options you give it through to node-sass, it should suffice to pass the option like this in your grunt file:

sass: {
  options: {
    precision: 10,
    // other options
  },
  // your targets
}
like image 62
raphinesse Avatar answered Nov 18 '22 01:11

raphinesse


A recent issue posted in the project reveals that this currently isn't possible.

The very same issue also points out that such an option hwoever could be added in the future without too much effort. It also points out a related issue that suggests raising the default precision across all SASS-implementations so that this won't be as much of an issue anymore.

like image 1
VoxPelli Avatar answered Nov 18 '22 00:11

VoxPelli