You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When creating Web apps, I often use data attribute to pass the value generated from server to JS through HTML. For keeping critical styles that are depending on attribute values, I have thought it is useful to make a solution to mark a bunch of attributes that have the same rule, as "dynamic".
Describe the solution you'd like
Allow RegExp patterns in dynamicAttributes, such as [/^data-.+/].
Describe alternatives you've considered safelist: It works well enough to keep selectors for dynamic attributes. However, sometimes need to want more fine tuning. (e.g. purge styles for the custom element such as <data-table> provided by a framework, and keep user styles for data- attribute)
Additional context
Currently dynamicAttributes just ignores RegExp. If it was supported, the consistency of PurgeCSS configuration would be improved too.
Another useful case of RegExp pattern is /^.+$/. It can treat all attribute selectors as dynamic, and protect from unexpected purging.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
When creating Web apps, I often use data attribute to pass the value generated from server to JS through HTML. For keeping critical styles that are depending on attribute values, I have thought it is useful to make a solution to mark a bunch of attributes that have the same rule, as "dynamic".
Describe the solution you'd like
Allow RegExp patterns in
dynamicAttributes
, such as[/^data-.+/]
.Describe alternatives you've considered
safelist
: It works well enough to keep selectors for dynamic attributes. However, sometimes need to want more fine tuning. (e.g. purge styles for the custom element such as<data-table>
provided by a framework, and keep user styles fordata-
attribute)Additional context
Currently
dynamicAttributes
just ignores RegExp. If it was supported, the consistency of PurgeCSS configuration would be improved too.Another useful case of RegExp pattern is
/^.+$/
. It can treat all attribute selectors as dynamic, and protect from unexpected purging.The text was updated successfully, but these errors were encountered: