Comments (5)
Hi, thanks for your issue. This is actually a greay idea and not hard to implement (as far I could think of).
You have any idea what kind of function you want to pass as alternative nameGenerator? Maybe we can pass another generate
function?
from node-rename-css-selectors.
It's in rcs-core now!
Preventing ad
is indeed possible with the upcoming reserve
array in the config file. These won't be generated anymore (without tweaking with the name generator at all). Yet, you can write your own too, and you'll have the information about what needs to be generated as the second argument (so when given an attribute selector, just call the default generator).
from node-rename-css-selectors.
Yes, a way to pass in our own generator function would be awesome. This is an article with excellent example of a custom name generation method used in conjunction with generateScopedName feature of babel's css-modules plugin.
IMHO, we don't really need something that extensive. A simple option to use a custom name generator function will do.
'generator': className => { .. }
from node-rename-css-selectors.
Hey @pacifier007. I introduced useCustomGenerator
in this PR JPeer264/node-rcs-core#64. I am still not quite done yet because I need your help. In useCustomGenerator
you have to pass in a function where a object is passed as parameter. In this object type
is a key which the possible values: keyframe
, selector
or attributeSelector
.
The only thing is that I have troubles with the type attributeSelector
as you, as user, have to know what kind of attribute selector it is, that it won't crash the attribute selectors. The type attributeSelector
means, that this passed class is matching any attribute selector of your passed CSS files.
As a small example what I mean. Let's say you have an attribute selector [class=^begin]
, then you have to keep begin
in the beginning of every class which matches it. So here my question. How do you want to handle such cases? Should I pass two extra keys with 1. the matching character: e.g. ^
or $
and 2. the key what should stay the same? Or should I just pass the tail of the classes. E.g. if the class is beginners
then I would just pass ners
so you do not have to worry about the validation.
Or do you have another idea how it would make sense?
from node-rename-css-selectors.
ping @pacifier007
from node-rename-css-selectors.
Related Issues (20)
- 3.2.4 breaks calc with css variables HOT 2
- Messes up with the `~` character HOT 4
- Uncaught TypeError: (0 , r.default)(...).at is not a function HOT 4
- Ignore specific class HOT 1
- renaming html tags such as div HOT 3
- [BUG] It renames EJS HOT 7
- Add documentation for rcsCore usage in rename-css-selectors
- mismatched layout after running rcs HOT 3
- Integration with Gulp HOT 16
- Ids and classes are treated as the same identity HOT 10
- Not completely renamed if there's a line break between class names HOT 6
- Exclude classes with special characters HOT 6
- [Q] Webpack Usage? HOT 6
- Does this plugin optimize the library so most frequent classes get one letter not two? HOT 2
- Minify as a function HOT 2
- Bug: Textarea and other common words replaced HOT 3
- Unused css selectors given a one letter selector - is sorting by frequency working correctly? HOT 4
- getElementById string being replaced by class selector name instead of id
- Unchanging custom class name HOT 1
- Is it possible to use rcs-core with vite/rollup)?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-rename-css-selectors.