🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

postcss-custom-properties

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-custom-properties - npm Package Compare versions

Comparing version

to
0.3.1

5

CHANGELOG.md

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

# 0.3.1 - 2014-08-26
* nested custom properties usages are now correctly resolved
* undefined var doesn't throw error anymore (just a console warning) & are kept as is in the output
# 0.3.0 - 2014-08-25

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

18

index.js

@@ -118,4 +118,6 @@ /**

if (!replacement && !fallback) {
throw new Error(gnuMessage("variable '" + name + "' is undefined & don't have any fallback", source))
console.warn(gnuMessage("variable '" + name + "' is undefined & don't have any fallback", source))
}
// prepend with fallbacks
if (fallback) {

@@ -131,8 +133,20 @@ // resolve the end of the expression before the rest

// replace with computed custom properties
if (replacement) {
// resolve the end of the expression
(matches.post ? resolveValue(matches.post, variables, source) : [""]).forEach(function(afterValue) {
results.push(value.slice(0, start) + replacement + afterValue)
// resolve replacement if it use a custom property
resolveValue(replacement, variables, source).forEach(function(replacementValue) {
results.push(value.slice(0, start) + replacementValue + afterValue)
})
})
}
// nothing, just keep original value
if (!replacement && !fallback) {
// resolve the end of the expression
(matches.post ? resolveValue(matches.post, variables, source) : [""]).forEach(function(afterValue) {
results.push(value.slice(0, start) + value + afterValue)
})
}
})

@@ -139,0 +153,0 @@

2

package.json
{
"name": "postcss-custom-properties",
"version": "0.3.0",
"version": "0.3.1",
"description": "PostCSS plugin to polyfill W3C CSS Custom Properties for cascading variables",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,8 +5,7 @@ # postcss-custom-properties [![Build Status](https://travis-ci.org/postcss/postcss-custom-properties.png)](https://travis-ci.org/postcss/postcss-custom-properties)

**N.B.** For now the transformation _is not complete_. It currently just aims to provide a future-proof way of using a _limited subset_ of the features provided by native CSS variables.
**N.B.** For now the transformation _is not complete_. It currently just aims to provide a future-proof way of using a _limited subset (to `:root` selector)_ of the features provided by native CSS custom properties.
_[Checkout opened issue to know the state of this plugin](issues)._
_[Checkout opened issue to know the state of this plugin](https://github.com/postcss/postcss-custom-properties/issues)._
Why not `postcss-vars` ? Because [there is already a plugin with this name](http://github.com/iamvdo/postcss-vars) that have severals bugs & untested code.
But I look forward to merge those 2 plugins & deprecate this one ([see opened issue](https://github.com/iamvdo/postcss-vars/issues/4)).
Works great with [postcss-calc](https://github.com/postcss/postcss-calc).

@@ -13,0 +12,0 @@ ## Installation