Nunjucks 101's Comments


Holy cow, thanks for putting this on my radar. I can't seem to play with your examples as they don't work on your site as-is, but the formatting difference sold me on giving this another whirl when I was looking at it again the other day. I ended up doing some research and using 11ty + nunjucks to put together a little thing in vs code and it's working wonderfully. I realized safehou-se does something kind of similar to this (albiet more automated on the user-side) and as I've safehou-se'd a couple of my personal codes, it wasn't too hard to pick up, either. It's the solution to a huge problem I've been having while building my own website, so I'm "looking forward" to rebuilding it to be easier to update and fill out later, once I'm a little more used to playing with it on a test site.

Ah that would be because you need to declare the macros first! I only provided the code for one of these macros, as I was more just showing how it makes things more readable rather than providing nunjucks macros to use (though I might release some nunjucks snippets at some point!), but you can try out the tabButton macro I gave like so:Zq-E56-BKJ4-F.png

I'm glad to hear it was helpful for you, though, and I wish you luck with your website :)

Ah weird, the tab snippet gives me a render error on my end, saying stat isn't defined. I wonder if it's a browser/settings issue or something, as one of the scripts failed to load according to the inspector (also lots of font-awesome errors lmao); it explains why nothing I tried worked my first time around attempting this. Here I thought I was just completely confused on how macros worked. 🤣 

firefox_zbuPa21bwX.png

Ah that's because I didnt provide the stats macro! Only the button example has all the parts to be tested I'm afraid, if I get chance though I'll recreate these macros again so they can be played with :)

EDIT: OH and the font awesome one I have fixed but forgot to push to the live version of the site as I'm currently working on a new layout let me go fix that ty for the reminder <3

I THOUGHT THIS SAID NUNCHUCKS AIFBEIFBDOCND

I've been considering learning ninjucks. Thank you!

No worries, I hope you find it useful!

This user is not visible to guests.