-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
Change Whitelist Option #439
Comments
|
You also have to remove that "Children" things away. Perhaps one day in the future one parent will give a slap to his children. Then a bunch of morons who calls itself society decided to deprecate that word too. Like Children lives matter shit blah-blah. |
@ruslanchek noted. The proposal is more about simplifying the option that renaming it. whitelist: [''invisibleClass'],
whitelistPatterns: [/^nav-/]
whitelistPatternsChildren: [],
whitelistPatternsGreedy: [], to something like safelist: {
standard: ['invisibleClass', /^nav-/],
deep: [],
greedy: [],
keyframes: [], // new for keyframes
variables: [] // new for variables
} the object is also better in my opinion than having multiple what do you think? |
@Ffloriel sorry for emotional feedback the situation in the world is frustrating. About the object - that seems good! |
A small case in my usage. Trying to capture |
|
As per FullHuman/purgecss#439 whitelist was changed to safelist.
Context
Whitelist started as a simple option
whitelist
but grew up with the different use-cases and needs that appears with time.It is now more complex and overly complicated, and somewhat difficult to remember how to use it with the different option.
Below is a recap of the different options:
whitelist
In the example, the selectors .random, #yep, button will be left in the final CSS
whitelistPatterns
In the example, selectors ending with red such as .bg-red
whitelistPatternsChildren
In the example, children of selectors ending with blue such as
blue p
or.bg-blue .child-of-bg
whitelistPatternsGreedy
.my-module.color-blue {}
will be left in the final CSS even ifcolor-blue
is not seen as used by PurgeCSS.Changes Proposed
New Option Name
First, the option
whitelist
will change its name based on #428.whitelist
will be replaced bysafelist
. It will indicate which selectors are safe to leave in the final CSS.New Option: Blocklist
Blocklist will block the CSS selectors from appearing in the final output CSS. The selectors will be removed even when they are seen as used by PurgeCSS.
Even if
nav-links
andusedClass
are found by an extractor, they will be removed.Simplify the option
Two forms will be available. The simple form will be:
In this form, safelist is an array that can take a string or a regex.
The complex form will look like:
In this form, safelist is an object taking optional properties:
standard
is the same as the simple form and replaceswhitelist
andwhitelistPatterns
deep
replaceswhitelistPatternsChildren
greedy
is a new option coming from #424keyframes
can be used to add keyframes to the safelist, when usingkeyframes: true
(#418)variables
can be used to add CSS variables to the safelist, when usingvariables: true
standard
,deep
andgreedy
might have more intuitive and self explanatory names so open to suggestion and comments.Issues related:
#428
#418
#302
The text was updated successfully, but these errors were encountered: