Can't specify ::variants in custom utilities created with matchUtilities() #11916
-
Hi! ContextI wrote a utility to add space of a custom size into text. I can use it like this in html: <p>Here<span class="space-inline-8"/>There</p> And it will add space between the words "Here" and "There". I can increase the size of the space by replacing Here's my definition of the utility inside const plugin = require('tailwindcss/plugin')
module.exports = {
theme: {
extend: {
// ...
}
},
plugins: [
plugin(function({ addUtilities }) {
const thinSpace = '\u2009';
const maxValue = 100
const cssRules = {};
for (let i = 1; i <= maxValue; i++) {
cssRules[`.space-inline-${i}::before`] = {
content: "'" + thinSpace.repeat(i) + "'",
};
}
addUtilities(cssRules);
}),
]
} ProblemNote that my implementation is using SolutionI hope that there will be a way to specify Thank you for taking my feedback into consideration. If there's a way to do this, but I couldn't find it, then I'm sorry for the inconvenience. |
Beta Was this translation helpful? Give feedback.
Here's how you could do it via
matchUtilities()
.