konstaui / konsta

Mobile UI components made with Tailwind CSS
https://konstaui.com
MIT License
3.52k stars 131 forks source link

feat: add unocss config #131

Open riderx opened 1 year ago

riderx commented 1 year ago

This PR add support for Unocss.

Related to https://github.com/konstaui/konsta/issues/21

I'm not certain how to test what I have done.

So, I made the logic without testing.

If @antfu you are willing to have a check, specially for the transformation rule function, i'm not sure i understood it well

antfu commented 1 year ago

Sorry UnoCSS does not support Tailwind plugins, this probably won't work.

riderx commented 1 year ago

@antfu thank you so much for the answer. If you look in konsta code I modified, it doesn't use much tailwind code, since it's made originally to be around a tailwind config file. Like that :

const konstaConfig = require('konsta/config');

// wrap your config with konstaConfig
module.exports = konstaConfig({
  // rest of your usual Tailwind CSS config here
  ...
});

To what I have see there are hope!

My questions were more about how to rewrite the tailwind rule to make them work in UNOCSS. Konsta is the only nice alternative to ionic for mobile app design, it could be a nice addition to unopreset.

riderx commented 1 year ago

@antfu I think I'm not far from having made a Tailwind to Unocss preset function. Maybe that could be a project on his own.

Unocss is above Tailwind for me, but it lacks of all the plugins made for Tailwind, so with something with that I believe more and more people would switch.

I will continue to see if I can reach a viable point.

YishaqG commented 1 year ago

@riderx Have you make it work? I would also prefer using it with Unocss