1
1
// PostCSS CSS Variables (postcss-css-variables)
2
- // v0.4 .0
2
+ // v0.5 .0
3
3
//
4
4
// https://github.com/MadLittleMods/postcss-css-variables
5
5
@@ -24,7 +24,7 @@ var RE_VAR_PROP = (/(--(.+))/);
24
24
25
25
function eachCssVariableDeclaration ( css , cb ) {
26
26
// Loop through all of the declarations and grab the variables and put them in the map
27
- css . eachDecl ( function ( decl ) {
27
+ css . walkDecls ( function ( decl ) {
28
28
// If declaration is a variable
29
29
if ( RE_VAR_PROP . test ( decl . prop ) ) {
30
30
cb ( decl ) ;
@@ -42,7 +42,7 @@ function cleanUpNode(currentNodeToRemove) {
42
42
// Get a reference to it before we remove and lose reference to the child after removing it
43
43
currentNodeToPossiblyCleanUp = currentNodeToPossiblyCleanUp . parent ;
44
44
45
- nodeToRemove . removeSelf ( ) ;
45
+ nodeToRemove . remove ( ) ;
46
46
}
47
47
}
48
48
@@ -160,7 +160,7 @@ module.exports = postcss.plugin('postcss-css-variables', function(options) {
160
160
161
161
// Remove the variable declaration because they are pretty much useless after we resolve them
162
162
if ( ! opts . preserve ) {
163
- decl . removeSelf ( ) ;
163
+ decl . remove ( ) ;
164
164
}
165
165
// Or we can also just show the computed value used for that variable
166
166
else if ( opts . preserve === 'computed' ) {
@@ -186,7 +186,7 @@ module.exports = postcss.plugin('postcss-css-variables', function(options) {
186
186
187
187
// Collect all the rules that have declarations that use variables
188
188
var rulesThatHaveDeclarationsWithVariablesList = [ ] ;
189
- css . eachRule ( function ( rule ) {
189
+ css . walkRules ( function ( rule ) {
190
190
var doesRuleUseVariables = rule . nodes . some ( function ( node ) {
191
191
if ( node . type === 'decl' ) {
192
192
var decl = node ;
@@ -218,7 +218,7 @@ module.exports = postcss.plugin('postcss-css-variables', function(options) {
218
218
return ruleClone ;
219
219
} ) ;
220
220
221
- rule . removeSelf ( ) ;
221
+ rule . remove ( ) ;
222
222
}
223
223
224
224
// Resolve the declarations
0 commit comments