Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect and exclude random selectors #213

Open
fregante opened this issue Feb 19, 2022 · 2 comments
Open

Detect and exclude random selectors #213

fregante opened this issue Feb 19, 2022 · 2 comments
Assignees
Labels

Comments

@fregante
Copy link
Contributor

fregante commented Feb 19, 2022

With more and more websites using CSS modules, css-selector-generator often generates fickle selectors that are only valid until the next deployment.

Would it be possible to automatically detect and exclude these selectors, optionally?

Screen Shot 15 Screen Shot 14 Screen Shot 16

@fczbkk
Copy link
Owner

fczbkk commented Jul 9, 2022

@fregante You can use blacklist to filter these selectors:
https://github.com/fczbkk/css-selector-generator#blacklist

I already filter Angular attributes when generating attribute selectors:

// Angular attributes
'ng-*',

I'm not sure about hard-coding patterns for classnames like these into the library itself. Seems to me that it could lead to unforeseen false-positives. Maybe I could put together some examples of blacklists for specific libraries and list them in the Readme, to make it easy for users of this library to use them at their own risk. What do you think?

@biels
Copy link

biels commented May 4, 2023

Yes, add a callback to determine whether a class / id should be used in a selector. The user can use the method that suits best for him. For example detecting the entropy of the string, or using a whitelist, a regex, or any other method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants