A longtime Kobweb user put together a CSS-to-Kobwe...
# kobweb
d
A longtime Kobweb user put together a CSS-to-Kobweb converter. I'm floored. https://opletter.github.io/css2kobweb/ This can be a huge boon if you have a bunch of CSS (say, from a tutorial site online) and want to get it up and running quickly in your Kobweb project.
🎉 4
For example, if you start here: https://developer.mozilla.org/en-US/docs/Web/CSS/background and take one of the CSS examples and type it into the left hand side:
Copy code
background: center / contain no-repeat url("../../media/examples/firefox-logo.svg"),
            #eee 35% url("../../media/examples/lizard.png");
then the correct Modifier parameters show up on the right-hand size:
Copy code
Modifier
	.background(
		Color.rgb(0xeee),
		CSSBackground(
			image = BackgroundImage.of(url("../../media/examples/lizard.png")),
			position = BackgroundPosition.of(CSSPosition(35.percent))
		),
		CSSBackground(
			image = BackgroundImage.of(url("../../media/examples/firefox-logo.svg")),
			repeat = BackgroundRepeat.NoRepeat,
			position = BackgroundPosition.of(CSSPosition.Center),
			size = BackgroundSize.Contain
		)
	)
s
wow..super cool 👏
f
Thats amazing! Especially paired with some LLM that can generate CSS no problem. Thanks for sharing this
127 Views