css-length-to-px
Starting point: the Units library at https://github.com/heygrady/Units/blob/master/Length.js
Here is the related blog post of the Units library author:
http://heygrady.com/blog/2011/12/21/length-and-angle-unit-conversion-in-javascript/
Refactoring is done to the Units library.
Usage:
toPx(valToConvert, baseElem)