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

::v-deep code disappear #122

Closed
vvvhung opened this issue Sep 15, 2022 · 8 comments · Fixed by #125
Closed

::v-deep code disappear #122

vvvhung opened this issue Sep 15, 2022 · 8 comments · Fixed by #125

Comments

@vvvhung
Copy link

vvvhung commented Sep 15, 2022

My ::v-deep code to style the child things was purged. Is there any solution to prevent that?

@TheAlexLichter
Copy link
Member

Yes - probably whitelisting the selector. ☺️

@vvvhung
Copy link
Author

vvvhung commented Sep 19, 2022

I tried without success. It did not work with static generating. This is the scss:

::v-deep .card-hoder-name {
  .input-wrapper {
    border: 1px solid #6d64a4;
    position: relative;
    background: #494184;

    input {
      background-color: #352a7a00 !important;
      color: #ffffff !important;
    }
  }
}

I tried whitelisting like this:

purgeCSS: {
    whitelist: ['.card-hoder-name', 'card-hoder-name'],
  }

@TheAlexLichter
Copy link
Member

TheAlexLichter commented Sep 30, 2022

Try adding ::v-deep as regex to the whitelist.

like: whitelist: [/::v-deep/]

@vvvhung
Copy link
Author

vvvhung commented Oct 1, 2022

still no luck
and I'm using Nuxt2

@TheAlexLichter
Copy link
Member

In case these won't work, please try https://purgecss.com/safelisting.html#in-the-css-directly

If that doesn't work either, could you provide a minimal reproduction?
Happy to reopen the issue then

@vvvhung
Copy link
Author

vvvhung commented Oct 1, 2022

Still no luck. I created this repo as a minimal reproduction: https://github.com/vvvhung/purgecss-vdeep

@TheAlexLichter TheAlexLichter reopened this Oct 1, 2022
@TheAlexLichter
Copy link
Member

TheAlexLichter commented Oct 1, 2022

Could you try:

purgeCSS: {
    whitelistPatterns: [/::v-deep.*/]
  }

PS: In case you only want to purge Tailwind classes, then you can use the built-in purger of Tailwind ☺️
PPS: if you want to see support of the latest PurgeCSS version for Nuxt2 too, then please vote on #127 ☺️

@vvvhung
Copy link
Author

vvvhung commented Oct 1, 2022

�Yeah, it works. Thanks.
Sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants