postcss-custom-properties
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -0,1 +1,5 @@ | ||
# 2.1.0 - 2014-11-25 | ||
- Enhanced exceptions & messages | ||
# 2.0.0 - 2014-11-12 | ||
@@ -2,0 +6,0 @@ |
31
index.js
@@ -6,2 +6,3 @@ /** | ||
var balanced = require("balanced-match") | ||
var helpers = require("postcss-message-helpers") | ||
@@ -40,3 +41,3 @@ /** | ||
if (prop && prop.indexOf(VAR_PROP_IDENTIFIER) === 0) { | ||
console.warn(gnuMessage("Custom property ignored: not scoped to the top-level :root element (" + rule.selectors + " { ... " + prop + ": ... })" + (rule.parent.type !== "root" ? ", in " + rule.parent.type : ""))) | ||
console.warn(helpers.message("Custom property ignored: not scoped to the top-level :root element (" + rule.selectors + " { ... " + prop + ": ... })" + (rule.parent.type !== "root" ? ", in " + rule.parent.type : ""), decl.source)) | ||
} | ||
@@ -85,7 +86,9 @@ }) | ||
resolveValue(value, map, decl.source).forEach(function(resolvedValue) { | ||
var clone = decl.clone() | ||
clone.value = resolvedValue | ||
decl.parent.insertBefore(decl, clone) | ||
}) | ||
helpers.try(function resolve() { | ||
resolveValue(value, map, decl.source).forEach(function(resolvedValue) { | ||
var clone = decl.clone() | ||
clone.value = resolvedValue | ||
decl.parent.insertBefore(decl, clone) | ||
}) | ||
}, decl.source) | ||
@@ -125,7 +128,7 @@ if (!preserve) { | ||
if (!matches) { | ||
throw new SyntaxError(gnuMessage("missing closing ')' in the value '" + value + "'", source)) | ||
throw new SyntaxError("missing closing ')' in the value '" + value + "'") | ||
} | ||
if (matches.body === "") { | ||
throw new Error(gnuMessage("var() must contain a non-whitespace string", source)) | ||
throw new Error("var() must contain a non-whitespace string") | ||
} | ||
@@ -136,3 +139,3 @@ | ||
if (!replacement && !fallback) { | ||
console.warn(gnuMessage("variable '" + name + "' is undefined and used without a fallback", source)) | ||
console.warn(helpers.message("variable '" + name + "' is undefined and used without a fallback", source)) | ||
} | ||
@@ -173,11 +176,1 @@ | ||
} | ||
/** | ||
* return GNU style message | ||
* | ||
* @param {String} message | ||
* @param {Object} source | ||
*/ | ||
function gnuMessage(message, source) { | ||
return (source ? (source.file ? source.file : "<css input>") + ":" + source.start.line + ":" + source.start.column + " " : "") + message | ||
} |
{ | ||
"name": "postcss-custom-properties", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "PostCSS plugin to polyfill W3C CSS Custom Properties for cascading variables", | ||
@@ -25,3 +25,4 @@ "keywords": [ | ||
"dependencies": { | ||
"balanced-match": "~0.1.0" | ||
"balanced-match": "~0.1.0", | ||
"postcss-message-helpers": "^1.1.0" | ||
}, | ||
@@ -28,0 +29,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10252
2
144
+ Addedpostcss-message-helpers@1.1.1(transitive)