Socket
Socket
Sign inDemoInstall

postcss-automath-latest

Package Overview
Dependencies
17
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    postcss-automath-latest

Automatically evaluate mathematical expressions in your CSS source files, like in SASS or LESS. No special function calls needed as with `postcss-mathjs`.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
4.42 MB
Created
Weekly downloads
 

Changelog

Source

1.1.2

  • fix bug: Don't resolve '/' in border-radius.

Readme

Source

PostCSS Auto-Math

PostCSS plugin for evaluating math expressions in your CSS sources.

This plug-in uses the LESS parser internally, in an (intentionally) very limited way- just to parse mathematical expressions. As such, all unit handling mechanics are the same as in LESS.

If you want full LESS parsing functionality in your project, see postcss-less-engine.

.foo {
    font-size: 2 * 8px;	
    margin: 4px + 2 * 3px;
}
.foo {
    font-size: 16px;
    margin: 10px;
}

Usage

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

For best results, add the plugin after any variable parsing, mixin processing or function handling plugins. Since postcss-automath works on the final numeric values of your CSS you need to process all variables, mixins and other dynamic data beforehand.

See PostCSS docs for examples for your environment.

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.

How does this differ to postcss-math & postcss-mathjs?

Those plugins want you to add non-standard function wrappers (the resolve() function) around each expression you want evaluated. This module allows you to write normal math expressions you'd be used to from using SASS, SCSS or LESS.

Since the variable handling is deferred to another plugin, you are free to use this module with SCSS, LESS, W3C or even your own custom syntax.

Keywords

FAQs

Last updated on 15 Feb 2019

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