postcss-reduce-idents
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -0,1 +1,5 @@ | ||
# 1.0.3 | ||
* Improved performance by iterating the AST less times. | ||
# 1.0.2 | ||
@@ -2,0 +6,0 @@ |
10
index.js
@@ -10,3 +10,3 @@ 'use strict'; | ||
return list.space(value).map(function (val) { | ||
return list.comma(val).map(callback).join(','); | ||
return list.comma(val).map(callback).join(); | ||
}).join(' '); | ||
@@ -17,2 +17,3 @@ } | ||
var cache = {}; | ||
var ruleCache = []; | ||
// Encode at rule names and cache the result | ||
@@ -27,2 +28,3 @@ css.eachAtRule(atRuleRegex, function (rule) { | ||
rule.params = cache[rule.params].ident; | ||
ruleCache.push(rule); | ||
}); | ||
@@ -40,3 +42,3 @@ // Iterate each property and change their names | ||
// Ensure that at rules with no references to them are left unchanged | ||
css.eachAtRule(atRuleRegex, function (rule) { | ||
ruleCache.forEach(function (rule) { | ||
Object.keys(cache).forEach(function (key) { | ||
@@ -54,2 +56,3 @@ var k = cache[key]; | ||
var cache = {}; | ||
var declCache = []; | ||
css.eachDecl(/counter-(reset|increment)/, function (decl) { | ||
@@ -68,2 +71,3 @@ decl.value = eachValue(decl.value, function (value) { | ||
}); | ||
declCache.push(decl); | ||
}); | ||
@@ -84,3 +88,3 @@ css.eachDecl('content', function (decl) { | ||
}); | ||
css.eachDecl(/counter-(reset|increment)/, function (decl) { | ||
declCache.forEach(function (decl) { | ||
decl.value = eachValue(decl.value, function (value) { | ||
@@ -87,0 +91,0 @@ if (!/^-?\d*$/.test(value)) { |
@@ -12,9 +12,9 @@ 'use strict'; | ||
characters = characters + '0123456789-_'; | ||
while (remainder) { | ||
character = remainder % base; | ||
remainder = Math.floor(remainder / base); | ||
result = result + characters[character]; | ||
} | ||
} | ||
while (remainder) { | ||
character = remainder % base; | ||
remainder = Math.floor(remainder / base); | ||
result = result + characters[character]; | ||
} | ||
return result; | ||
}; |
{ | ||
"name": "postcss-reduce-idents", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Reduce custom identifiers with PostCSS.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
8417
114