Package Exports
- to-px
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (to-px) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
to-px
Get the scale factor to convert any CSS unit to px (logical pixel units).
Example
var toPX = require('to-px')
console.log(toPX('1em'))
console.log(toPX('.23vh'))
console.log(toPX('in'))Install
Note that this module only works within the DOM.
npm i to-pxAPI
var scaleFactor = require('to-px')(unit[, element])
Computes the number of pixels in the unit string.
unitis a CSS unit type or a number followed by CSS unit, egvhor2inelementis an optional element in which the unit is computed (default isdocument.body)
Returns The number of pixels in the unit
Note Conversions for % are not supported since they are context dependent.
License
(c) 2015 Mikola Lysenko. MIT License
