-
-
Notifications
You must be signed in to change notification settings - Fork 250
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
Value between rounded brackets for nth-child and nth-of-type pseudo-class gets purged if it starts with 'n' or '-n' #92
Comments
I have met the same bug. When I use gulp-purgecss, the nth-child and nth-last-child pseudo-class in my css would miss parameters in the output file.
|
I'm currently trying gulp-purgecss and i have the same bug… I can't change this selector to make it work, i have more others selectors with An example of a full selector i'm using is EDIT Workaround: If your value start by It's always crash for value start by OS: macOS 10.12.6 |
@Ffloriel - thanks for the fix! Is there a way for us to pull this in already, or do we need to wait for the next release? |
Release in 1.1.0 |
I am trying to get this issue pulled into my project so would like to update the purgecss plugin version: FullHuman/purgecss#92
I came across an issue in a project of mine where the value of both
nth-child
andnth-of-type
pseudo-classes are removed but only when the value between the rounded brackets starts with n, -n or -an, meaning these CSS rules are not valid and will not be shown:Input
Output
I am using the
gulp-purgecss
plugin in this project and when I comment out the line where I use it, my output is as expected so I am fairly certain it is a purgecss issue.To be sure I forked purgecss and added some tests for
nth-child
andnth-of-type
that confirm it does not behave as expected.Positive 'n' values
For now you can circumvent a part of the problem by adding a 1 before the n. This way purgecss behaves as expected and does not remove the value between the rounded brackets. This only works when using positive values though.
-n
and-an
values still get removed.Although you should be able to use
:nth-child(n+b)
or:nth-of-type(-n+b)
, since the csswg draft states the 1 may be omitted and that the value may be negative.Desktop
The text was updated successfully, but these errors were encountered: