postcss-reduce-idents
Advanced tools
Comparing version 6.0.0 to 6.0.1
{ | ||
"name": "postcss-reduce-idents", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "Reduce custom identifiers with PostCSS.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -17,2 +17,4 @@ 'use strict'; | ||
'grid-template-areas', | ||
'grid-template-columns', | ||
'grid-template-rows', | ||
]); | ||
@@ -57,2 +59,16 @@ | ||
} | ||
/* handle gridline name lists like [name1 name2] */ | ||
if (child.type === 'word') { | ||
const word = child.value; | ||
if (word.startsWith('[') && word.endsWith(']')) { | ||
const gridLine = word.slice(1, -1); | ||
addToCache(gridLine, encoder, cache); | ||
} else if (word.startsWith('[')) { | ||
const gridLine = word.slice(1); | ||
addToCache(gridLine, encoder, cache); | ||
} else if (word.endsWith(']')) { | ||
const gridLine = word.slice(0, -1); | ||
addToCache(gridLine, encoder, cache); | ||
} | ||
} | ||
}); | ||
@@ -84,2 +100,26 @@ | ||
} | ||
/* replace gridline names inside lists like [name] */ | ||
if ( | ||
word.startsWith('[') && | ||
word.endsWith(']') && | ||
word.slice(1, -1) in cache | ||
) { | ||
const gridLine = word.slice(1, -1); | ||
node.value = node.value.replace( | ||
gridLine, | ||
cache[gridLine].ident | ||
); | ||
} else if (word.startsWith('[') && word.slice(1) in cache) { | ||
const gridLine = word.slice(1); | ||
node.value = node.value.replace( | ||
gridLine, | ||
cache[gridLine].ident | ||
); | ||
} else if (word.endsWith(']') && word.slice(0, -1) in cache) { | ||
const gridLine = word.slice(0, -1); | ||
node.value = node.value.replace( | ||
gridLine, | ||
cache[gridLine].ident | ||
); | ||
} | ||
}); | ||
@@ -86,0 +126,0 @@ node.value = node.value.replace(/\s+/g, ' '); // merge white-spaces |
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
20836
534