🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

postcss-calc

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-calc - npm Package Compare versions

Comparing version

to
5.1.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 5.1.0 - 2016-01-07
- Added: "warnWhenCannotResolve" option to warn when calc() are not reduced to a single value
# 5.0.0 - 2015-08-25

@@ -2,0 +6,0 @@

@@ -8,2 +8,4 @@ /**

var CONTAINS_CALC = /calc\(.*\)/
/**

@@ -16,4 +18,6 @@ * PostCSS plugin to reduce calc() function calls.

var preserve = options.preserve
var warnWhenCannotResolve = options.warnWhenCannotResolve
return function(style) {
return function(style, result) {
style.walkDecls(function transformDecl(decl) {

@@ -27,2 +31,7 @@ if (!decl.value || decl.value.indexOf("calc(") === -1) {

if (warnWhenCannotResolve && CONTAINS_CALC.test(value)) {
result.warn("Could not reduce expression: " + decl.value,
{plugin: "postcss-calc", node: decl})
}
if (!preserve) {

@@ -29,0 +38,0 @@ decl.value = value

7

package.json
{
"name": "postcss-calc",
"version": "5.0.0",
"version": "5.1.0",
"description": "PostCSS plugin to reduce calc()",

@@ -14,6 +14,3 @@ "keywords": [

"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/postcss/postcss-calc.git"
},
"repository": "https://github.com/postcss/postcss-calc.git",
"files": [

@@ -20,0 +17,0 @@ "index.js"

@@ -110,2 +110,13 @@ # postcss-calc [![Build Status](https://travis-ci.org/postcss/postcss-calc.png)](https://travis-ci.org/postcss/postcss-calc)

#### `warnWhenCannotResolve` (default: `false`)
Adds warnings when calc() are not reduced to a single value.
```js
var out = postcss()
.use(calc({warnWhenCannotResolve: true}))
.process(css)
.css
```
---

@@ -112,0 +123,0 @@