Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-math

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-math

PostCSS plugin for making calculations with math.js

  • 0.0.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.6K
decreased by-14.5%
Maintainers
1
Weekly downloads
 
Created
Source

PostCSS Math Build Status

Work-in-progress!

PostCSS plugin for making calculations with math.js.

This plug-in supports:

  • Plain-old maths, as per math.js built-in functionality
  • px, em, rem, vh, vmax and other units
  • CSS-friendly rendering (10cm not 10 cm)
  • Unit stripping e.g. strip(25px) becomes 25
  • Unit math operations e.g. floor(12.6px) becomes 12px and ceil(12.6px) becomes 13px

Contributions are very welcome!

.foo {
    font-size: resolve(2 * 8px);
    padding: resolve(strip(16cm) + (2px * 3));
    margin: resolve(4px + resolve(2 * 3px));
}
.foo {
    font-size: 16px;
    padding: 22px;
    margin: 10px;
}

Usage

postcss([ require('postcss-math') ])

See PostCSS docs for examples for your environment.

Using postcss-assets?

You can pass in a functionName option to switch to something other than resolve.

How does this differ to postcss-calc?

They're (deliberately) trying to work towards the calc(...) standard, so for instance it doesn't support things like exponentials at the moment. This wraps up math.js so you have a wider range of things you can do.

Keywords

FAQs

Package last updated on 02 Jan 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc