-
-
Notifications
You must be signed in to change notification settings - Fork 882
UnoCSS support (3.0) #5485
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
base: main
Are you sure you want to change the base?
UnoCSS support (3.0) #5485
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
57a3b33 tested and works. // Modified from examples/custom_vue_element/counter.js to use Tailwind classes
export default {
template: `
<button
@click="handle_click"
:class="[
'px-4 py-2 rounded-md transition-colors',
value > 0 ? 'bg-green-200 hover:bg-green-300' : 'bg-gray-200 hover:bg-gray-300'
]"
>
<strong>{{ title }}: {{ value }}</strong>
</button>
`,
props: {
title: String,
},
data() {
return {
value: 0,
};
},
methods: {
handle_click() {
this.value += 1;
this.$emit("change", this.value);
},
reset() {
this.value = 0;
},
},
}; |
evnchn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted some mistakes while on the train
| ui.run(uvicorn_reload_includes='*.py, *.css, *.html', reload=not on_fly, | ||
| reconnect_timeout=10.0, tailwind=False, unocss_preset='wind4') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidentally left this in there. Oh well. Let's remove this before we merge (or not, since it works)
|
Actually is the observer needed? All of NiceGUI components do not add Tailwind classes programmatically... Perhaps configurable?
|
Motivation
Due to various reasons it may not be good to have ourselves tied down to using Tailwind CDN JS
So this PR want to enable UnoCSS support, an atomic and configurable CSS engine.
Implementation
Compared to predecessor #4832, this is more clean because:
allClasses, whichgenerateStylesFromClassestakes no argument, cleaner for loop, etc)Going over the changes briefly:
ui.runui.run_withandAppConfigProgress