I made like a template editor thingy thing
So basically i needed a way to like, share/evaluate code across different files. Normally i would use something like modules to import/export stuff. but that doesn't work for HTML files, and it needs an extra network request which i don't like. Also it doesn't work at all if the user has JavaScript disabled
Most developers use a build step like Vite or Webpack or whatever... but i refuse to use any frameworks/build tools/libraries unless absolutely necessary. I like doing it myself since it helps me learn along the way and it's really fun!!
One way i'm using this right now is to always have the log thing be to the latest entry so i don't have to keep updating it myself
Demo
<!--{{
return 'red orange yellow green blue indigo violet black white'.split(' ').map(o=>`<span style="color: ${o}">I love ${o}</span>`).join('<br>')
}}-->
Result:
I love redI love orange
I love yellow
I love green
I love blue
I love indigo
I love violet
I love black
I love white
You might be thinking, Why not just run the code and then paste the result?
Well for one, i would
have to keep the code with me at all times which is REAL annoying.
When it's like this i can just edit it and save and there's no copying/pasting needed.
And obviously, the only other option is to manually type that out which is even worse:
<span style="color: red">I love red</span><br><span style="color: orange">I love orange</span><br><span style="color: yellow">I love yellow</span><br><span style="color: green">I love green</span><br><span style="color: blue">I love blue</span><br><span style="color: indigo">I love indigo</span><br><span style="color: violet">I love violet</span><br><span style="color: black">I love black</span><br><span style="color: white">I love white</span>
It's kinda like client side PHP i guess!!
This might just be the best thing i've ever made
When i look back on where i was like simply 1 year ago it's kinda insane how
much i've learned and how much better i am now. I'm REALLYYY proud of myself
🥹🥹🥹