11// PostCSS CSS Variables (postcss-css-variables)
2- // v0.4 .0
2+ // v0.5 .0
33//
44// https://github.com/MadLittleMods/postcss-css-variables
55
@@ -24,7 +24,7 @@ var RE_VAR_PROP = (/(--(.+))/);
2424
2525function eachCssVariableDeclaration ( css , cb ) {
2626 // 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 ) {
2828 // If declaration is a variable
2929 if ( RE_VAR_PROP . test ( decl . prop ) ) {
3030 cb ( decl ) ;
@@ -42,7 +42,7 @@ function cleanUpNode(currentNodeToRemove) {
4242 // Get a reference to it before we remove and lose reference to the child after removing it
4343 currentNodeToPossiblyCleanUp = currentNodeToPossiblyCleanUp . parent ;
4444
45- nodeToRemove . removeSelf ( ) ;
45+ nodeToRemove . remove ( ) ;
4646 }
4747}
4848
@@ -160,7 +160,7 @@ module.exports = postcss.plugin('postcss-css-variables', function(options) {
160160
161161 // Remove the variable declaration because they are pretty much useless after we resolve them
162162 if ( ! opts . preserve ) {
163- decl . removeSelf ( ) ;
163+ decl . remove ( ) ;
164164 }
165165 // Or we can also just show the computed value used for that variable
166166 else if ( opts . preserve === 'computed' ) {
@@ -186,7 +186,7 @@ module.exports = postcss.plugin('postcss-css-variables', function(options) {
186186
187187 // Collect all the rules that have declarations that use variables
188188 var rulesThatHaveDeclarationsWithVariablesList = [ ] ;
189- css . eachRule ( function ( rule ) {
189+ css . walkRules ( function ( rule ) {
190190 var doesRuleUseVariables = rule . nodes . some ( function ( node ) {
191191 if ( node . type === 'decl' ) {
192192 var decl = node ;
@@ -218,7 +218,7 @@ module.exports = postcss.plugin('postcss-css-variables', function(options) {
218218 return ruleClone ;
219219 } ) ;
220220
221- rule . removeSelf ( ) ;
221+ rule . remove ( ) ;
222222 }
223223
224224 // Resolve the declarations
0 commit comments