JSPM

@gravitylabs/css-viewport-units-transform

0.10.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q31087F
  • License MIT

Transform CSS viewport units of a style object to pixels based on window dimensions

Package Exports

  • @gravitylabs/css-viewport-units-transform
  • @gravitylabs/css-viewport-units-transform/dist/index.js

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 (@gravitylabs/css-viewport-units-transform) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

css-viewport-units-transform

Build Status Coverage Status Size contributions welcome

Transform CSS viewport units of a Javascript style object to pixels based on window dimensions.

Supports vw, vh, vmin and vmax units.

import { transform } from "css-viewport-units-transform";
// or const transform = require("css-viewport-units-transform").transform;

transform(
  {
    fontSize: "10vw"
  },
  {
    width: 480,
    height: 100
  }
);

↓ ↓ ↓ ↓ ↓ ↓

{
  fontSize: 48;
}

or

transform(
  {
    myClass: {
      fontSize: "10vh"
    }
  },
  {
    width: 480,
    height: 100
  }
);

↓ ↓ ↓ ↓ ↓ ↓

{
  myClass: {
    fontSize: 10,
  }
}

Dependencies

  • None