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

Legal comments in CSS are removed when empty legal comments are present #1796

Closed
adamwathan opened this issue Nov 23, 2021 · 3 comments
Closed

Comments

@adamwathan
Copy link

Given this input:

.example {
  --some-var: var(--tw-empty, /*!*/ /*!*/);
}

/*! I_need_this_comment */

body {
  background-color: red;
}

esbuild produces this output when running esbuild ... --legal-comments=inline:

.example {
  --some-var: var(--tw-empty, );
}

body {
  background-color: red;
}

Removing the /*!*/ /*!*/ nonsense is probably fine (we have to do it in Tailwind to preserve the whitespace between them in some overly aggressive minifiers), but I would at least expect the /!* I_need_this_comment */ comment to be preserved.

If you remove the this line, the comment is preserved as expected:

  .example {
-   --some-var: var(--tw-empty, /*!*/ /*!*/);
  }
  
  /*! I_need_this_comment */
  
  body {
    background-color: red;
  }

Related: tailwindlabs/tailwindcss#6182

Thanks!

@adamwathan
Copy link
Author

Legend 🙏

@frederikhors
Copy link

@evanw I saw that in the CHANGELOG there are some breaking for the next version. Can I ask you to release this as a fix so any libraries that have ~ in version can be upgraded? Thanks!

@frederikhors
Copy link

@evanw can you please release a patch?

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

No branches or pull requests

2 participants