1.1.0 • Published 5 years ago

css-convert-units v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

CSS Convert Units

Build Status npm npm downloads GitHub license

CSS Convert Units is a library for convert css unit to another unit.

Getting Started

Use the npm or yarn to install dependencies.

$ npm i css-convert-units

or

$ yarn add css-convert-units

Here is a description of an imaginary function convertUnit :

convertUnit(convertFrom, [convertTo], [dpi])

List of units support :

  • density independen pixel (dp)
  • pixel (px)
  • scale independen pixel (sp)
  • millimeter (mm)
  • inch (in)
  • point (pt)
  • remme (rem)

convertTo & dpi are optional parameters, convertTo will be filled by default with rem and dpi will be default with mdpi.

check ./index.js file:

let convertUnit = require('css-convert-units')

Code Examples:

convertUnit('1pt', 'px', 'mdpi') // output : 2.22px
convertUnit('1pt', 'px') // output : 2.22px
convertUnit('1px', 'rem', 'mdpi') // output : 0.0625rem
convertUnit('1px', 'rem') // output : 0.0625rem (mdpi is default dpi)
convertUnit('1px') // output : 0.0625rem (rem is default unit)

Maintainers

Dwi Agustianto - @agusID

See also the list of contributors who participated in this project.

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago