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

Feature: Ignore HTML sections #380

Open
dnwhte opened this issue Jul 19, 2018 · 0 comments · May be fixed by #441
Open

Feature: Ignore HTML sections #380

dnwhte opened this issue Jul 19, 2018 · 0 comments · May be fixed by #441
Projects

Comments

@dnwhte
Copy link

dnwhte commented Jul 19, 2018

This is a bit of an edge case, but it would be great to be able to have uncss ignore sections/elements within the html. My thought is that it'd be nice to add a class (eg. ".uncss-ignore") to an element and have uncss not include it in its processing.

Our use case is that we're using the html our pattern library exports for uncss' reference. The html includes a lot of examples and reference components that may or may not end up being used in an actual pattern.

Example use:

<!-- .c-component rule would be removed, because uncss ignored the section -->
<div class="uncss-ignore c-component"></div>

<!-- .c-component rule would NOT be removed -->
<div class="c-component"></div>

I have a POC working. It works by removing elements with the 'uncss-ignore' class from the DOM before the call to findAll in getUsedSelectors. I'll submit a PR soon for you to take a look at.

@giakki giakki added this to To do in To-do board via automation Feb 13, 2020
@giakki giakki moved this from To do to To plan in To-do board Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
To-do board
  
To plan
Development

Successfully merging a pull request may close this issue.

1 participant