-
Notifications
You must be signed in to change notification settings - Fork 29
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
Using custom rules in modules #75
Comments
I think whenever a rule is implemented with any assumption about the actual DOM (or keywords as in #73) in mind, a custom filter would be useful to support extensions (like MathML) or additional keywords. At best, this would not only allow to extend the current assumptions (like adding further boolean attributes to Looking through the existing rules, this would concern:
To go all the way, the rules regarding Javascript, CSS, SVG and JSON could also be extended (to allow other tags for example), but I am unsure if any user of htmlnano has a use case for this -- wherefore I would skip these for now. However, For nearly all cases, this would just mean to add an option to provide a custom list of strings, as only tags or attributes are specified. Only I am unsure how a general API should look like. Do you already have something in mind? |
Thanks for posting your ideas!
No, not yet. But I'll definitely think about it. |
In #73 @sebastianniemann suggested extending removeComments module to support custom filter rules.
It made me think if such custom rules could come in handy in other modules. For example, to pass additional attributes or complex rules to removeRedundantAttributes module. In that case, I think we'd be better off creating some general API or approach applicable to all modules, which might be different from RegExp you suggested.
@sebastianniemann, do you have any thoughts about this idea?
The text was updated successfully, but these errors were encountered: