Socket
Socket
Sign inDemoInstall

postcss-custom-properties

Package Overview
Dependencies
10
Maintainers
3
Versions
85
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.1.0 to 6.2.0

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# 6.2.0 - 2017-10-06
- Added: `noValueNotifications` option (#71)
- Fixed: Typo in `prefixedVariables` variable name (#77)
# 6.1.0 - 2017-06-28

@@ -2,0 +7,0 @@

26

dist/index.js

@@ -26,3 +26,3 @@ "use strict";

var globalWarnings = void 0;
var globalOpts = void 0;

@@ -64,4 +64,10 @@ /**

if (!variable && !fallback) {
if (globalWarnings) {
result.warn("variable '" + name + "' is undefined and used without a fallback", { node: decl });
if (globalOpts.warnings) {
var errorStr = `variable '${name}' is undefined and used without a fallback`;
if (globalOpts.noValueNotifications === "error") {
throw decl.error(errorStr, { word: name });
} else {
result.warn(errorStr, { node: decl });
}
}

@@ -98,3 +104,3 @@ post = matches.post ? resolveValue(matches.post, variables, result, decl) : [""];

if (!fallback) {
if (globalWarnings) {
if (globalOpts.warnings) {
result.warn("Circular variable reference: " + name, { node: decl });

@@ -133,3 +139,3 @@ }

if (!variables) {
return prefixVariables;
return prefixedVariables;
}

@@ -167,6 +173,8 @@

globalWarnings = options.warnings === undefined ? true : options.warnings;
globalOpts = {
warnings: options.warnings === undefined ? true : options.warnings,
noValueNotifications: options.noValueNotifications || "warning"
// define variables
style.walkRules(function (rule) {
// define variables
};style.walkRules(function (rule) {
var toRemove = [];

@@ -178,3 +186,3 @@

var prop = decl.prop;
if (globalWarnings && prop && prop.indexOf(VAR_PROP_IDENTIFIER) === 0) {
if (globalOpts.warnings && prop && prop.indexOf(VAR_PROP_IDENTIFIER) === 0) {
result.warn("Custom property ignored: not scoped to the top-level :root " + `element (${rule.selectors} { ... ${prop}: ... })` + (rule.parent.type !== "root" ? ", in " + rule.parent.type : ""), { node: decl });

@@ -181,0 +189,0 @@ }

{
"name": "postcss-custom-properties",
"version": "6.1.0",
"version": "6.2.0",
"description": "PostCSS plugin to polyfill W3C CSS Custom Properties for cascading variables",

@@ -22,12 +22,12 @@ "keywords": [

"balanced-match": "^1.0.0",
"postcss": "^6.0.3"
"postcss": "^6.0.13"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-cli": "^6.26.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-env": "^1.5.2",
"babel-register": "^6.24.1",
"eslint": "^4.1.1",
"babel-preset-env": "^1.6.0",
"babel-register": "^6.26.0",
"eslint": "^4.8.0",
"npmpub": "^3.1.0",
"tape": "^4.7.0"
"tape": "^4.8.0"
},

@@ -34,0 +34,0 @@ "scripts": {

@@ -1,2 +0,2 @@

# postcss-custom-properties [![Build Status](https://travis-ci.org/postcss/postcss-custom-properties.svg)](https://travis-ci.org/postcss/postcss-custom-properties)
# postcss-custom-properties [![CSS Standard Status](https://jonathantneal.github.io/css-db/badge/css-variables.svg)](https://jonathantneal.github.io/css-db/#css-variables) [![Build Status](https://travis-ci.org/postcss/postcss-custom-properties.svg)](https://travis-ci.org/postcss/postcss-custom-properties)

@@ -62,2 +62,20 @@ > [PostCSS](https://github.com/postcss/postcss) plugin to transform [W3C CSS Custom Properties for ~~cascading~~ variables](http://www.w3.org/TR/css-variables/) syntax to more compatible CSS.

You can also compile CSS custom properties with their fallback value.
Using this `input.css`:
```css
div {
color: var(--color, #f00);
}
```
you will get:
```css
div {
color: #f00;
}
```
Note that plugin returns itself in order to expose a `setVariables` function

@@ -133,2 +151,11 @@ that allow you to programmatically change the variables.

### `noValueNotifications`
Default: `'warning'`
Values: `'warning'|'error'`
If it is set to `'error'`, using of undefined variable will throw an error.
---

@@ -135,0 +162,0 @@

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