nuejs / nue

A web framework for UX developers
https://nuejs.org
MIT License
6.04k stars 179 forks source link

Nuemark: How to add svg inside a button #277

Open Korab-Doroci opened 3 months ago

Korab-Doroci commented 3 months ago

Describe the Bug

Using Nuemark, I can't get this example to work. The only way I found to get around it is to make the button a div, but that is not the behaviour I'm after.

This doesn't work: [button] [mysvg] Learn More

This works but isn't a button: [button] [mysvg] Learn More

Environment

Example:

Minimal Reproduction

  1. Create a new skeleton project using bun create nue
  2. Add an svg of choice inside of layout.html, and give the svg a @name="mysvg"
  3. Inside index.md, add a the code from the example that doesn't work
Korab-Doroci commented 3 months ago

I have made a small change in the nuemark code to enable svgs and other components inside of buttons now. The only limitation I found was that the components cant be inside the layout.html, needs to be in a .nue file. Is this something that is worth creating a pull request for?

nobkd commented 3 months ago

Sure, give it a try, maybe we even find a way to allow layout components.

(The latest merge commit has some problems test-wise with jest currently. You can test jest without it, if you do your changes after git reset --hard HEAD~1. Test commands / environment can be found here)