shortnames: Add possibility to set classname characters
Opened this issue ยท 2 comments
๐ Hey, it would be great if it was possible to set characters, used in shortnames
generated classes. For example, I'd prefer them to be only lowercase.
Feature Use Case
namer: shortnames({ letters: [a...z, 0...9] })
// or
namer: shortnames({ case: 'lower' })
Feature Proposal
Add option to set letters used in classes or letter case.
From source code, alphabet
package is used inside which already has methods to return only lowercase/uppercase letters.
Btw shortnames is located under packages/namer, wondering why ๐ค
Btw shortnames is located under packages/namer, wondering why
That's left over from before this was a monorepo, hasn't been important to rename it but wanted to give the package a more-descriptive name on NPM.
I think this would be really easy to add, based on looking at namer.js
:
modular-css/packages/namer/namer.js
Line 19 in 8a9214e
Would need to take an option like shortnames({ identifiers : [ ... ] })
, and the default value should be the already-existing everything
value from up above.
modular-css/packages/namer/namer.js
Line 4 in 8a9214e
Then it's a matter of using the identifiers
param instead of everything
whenever value(...)
is called.
modular-css/packages/namer/namer.js
Line 42 in 8a9214e
I have a package that generates short strings in a given alphabet: darthmaim/short-string.
I even wrote a package specifically for modular-css: darthmaim/modular-css-short-namer, but this will always use the default alphabet.