Socket
Socket
Sign inDemoInstall

css-calc-polyfill

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    css-calc-polyfill

css3 calc polyfill


Version published
Maintainers
1
Install size
105 kB
Created

Readme

Source

css-calc-polyfill

CSS3 calc polyfill.

This project is based on calc-polyfill and viewport-units-buggyfill. It aims to do calc polyfill by the viewport-units-buggyfill hack approach:

  1. use postcss-viewport-units to automatically append unsupported calc declarations to content declaration
  2. init this polyfill so it could retrieve all preserved calc declarations
  3. internally refresh so changed elements could get proper styles

Install

$ npm install -D css-calc-polyfill

Usage

import { init, process, refresh } from 'css-calc-polyfill';

const refreshCalc = () => {
  setTimeout(() => {
    refresh();
    refreshCalc();
  }, 1000);
};

document.addEventListener('DOMContentLoaded', () => {
  init({
    contentPrefix: 'viewport-units-buggyfill;' // reuse `postcss-viewport-units` prefix
  });
  process(); // first run, also boot `calc` declaration cache
  refreshCalc(); // internally refresh element styles using cache
});

License

MIT

FAQs

Last updated on 01 Apr 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc