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

feat: remove un-cloak to html node as well as body #2026

Merged
merged 1 commit into from Dec 30, 2022
Merged

feat: remove un-cloak to html node as well as body #2026

merged 1 commit into from Dec 30, 2022

Conversation

vbrajon
Copy link
Contributor

@vbrajon vbrajon commented Dec 29, 2022

For one use case, I have an "un-cloak" attribute added automatically to the html tag dynamically before the body exist.
Plus I find this intuitive to have the attribute on the html tag, the fact that both work seems better to me.
Thanks for your work !

You can try here the following 2 links (to copy paste in URL):

data:text/html,

<style>[un-cloak]{display:none}</style> <script type="module"> import initUnocssRuntime from "https://patch.deno.dev/@unocss/runtime?dev"; initUnocssRuntime(); </script>
will show

data:text/html,

<style>[un-cloak]{display:none}</style> <script type="module"> import initUnocssRuntime from "https://esm.sh/@unocss/runtime?dev"; initUnocssRuntime(); </script>
will not show

The patch is available here: https://dash.deno.com/playground/patch

@netlify
Copy link

netlify bot commented Dec 29, 2022

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a2b0a52
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/63ad92cc58577400095e4674
😎 Deploy Preview https://deploy-preview-2026--unocss.netlify.app/play
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@vbrajon
Copy link
Contributor Author

vbrajon commented Dec 29, 2022

To check that this works as expected you can do:

document.documentElement.setAttribute('un-cloak', '')

In the preview playground, the runtime automatically delete it: https://deploy-preview-2026--unocss.netlify.app/play/
In the production, the runtime let it be: https://uno.antfu.me/play/

@vbrajon vbrajon changed the title feat: remove un-cloak to html node as well as body fix: remove un-cloak to html node as well as body Dec 29, 2022
@antfu antfu changed the title fix: remove un-cloak to html node as well as body fix(runtime): remove un-cloak to html node as well as body Dec 30, 2022
@antfu antfu enabled auto-merge (squash) December 30, 2022 12:09
@antfu antfu disabled auto-merge December 30, 2022 12:10
@antfu antfu changed the title fix(runtime): remove un-cloak to html node as well as body feat: remove un-cloak to html node as well as body Dec 30, 2022
@antfu antfu merged commit b19f595 into unocss:main Dec 30, 2022
@vbrajon vbrajon deleted the patch-1 branch December 30, 2022 13:13
praburangki pushed a commit to praburangki/unocss that referenced this pull request Jan 12, 2023
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 this pull request may close these issues.

None yet

2 participants