Skip to content

Commit

Permalink
fix: adds proper indexing when generating colors (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
joesobo committed May 10, 2022
1 parent 47efe57 commit 0e500b6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cli/core/ClassnamesGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,11 @@ export class ClassnamesGenerator {
.replace('background', 'bg');

const classnamesWithColors = propertyKeys
// Exclude `DEFAULT` keys from the keys collection as they do not correspond to any classname.
.filter(k => k !== 'DEFAULT')
// Then, for every key of the property...
// For every key of the property...
.flatMap((colorName, i) => {
// Exclude `DEFAULT` keys from the keys collection as they do not correspond to any classname.
if (propertyKeys[i] === 'DEFAULT') return null;

// Get the value that corresponds to that key. NOTE: It can be `string` or an `object` of shades.
const colorValue = propertyValues[i];

Expand Down Expand Up @@ -488,7 +489,8 @@ export class ClassnamesGenerator {
return `${utilName}-${colorName}`;
}
}
});
})
.filter(Boolean) as string[];

// // Add the opacities short hand suffix `/{opacity}`: "bg-red-100/50"
// const classnamesWithColorsAndOpacitySuffix = Object.keys(
Expand Down

0 comments on commit 0e500b6

Please sign in to comment.