JSPM

@lunelson/sass-calc

0.9.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 41
  • Score
    100M100P100Q85459F
  • License MIT

Augmented math in Sass via CSS calc()

Package Exports

  • @lunelson/sass-calc

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

Readme

sass-calc

'sass calc'

Build Status

Harness the power of CSS calc() expressions in Sass math.

Use add(), subtract(), multiply() and divide() on values which may have incompatible units, or which are calc() expressions themselves, and return a calc() expression as a result.

# install
npm install --save @lunelson/sass-calc
// test.scss
@import 'sass-calc/index';
$expr: calc(100vw - 50%);
.test {
  test: subtract(1.5em, 1em);
  test: add(1.5em, 1rem);
  test: add(multiply($expr, 2), 10px);
  test: divide(subtract(1.5em, 1em), 2);
  test: subtract(divide(subtract(1.5em, 1em), 2), add(1em, 1ex));
}
/* test.css */
.test {
  test: 0.5em;
  test: calc(1.5em + 1rem);
  test: calc(((100vw - 50%) * 2) + 10px);
  test: 0.25em;
  test: calc(0.25em - (1em + 1ex));
}

Refs:

Questions? Twitter.