janl / mustache.js

Minimal templating with {{mustaches}} in JavaScript
https://mustache.github.io
MIT License
16.37k stars 2.4k forks source link

<script src=??? #823

Closed JamesGiaquinto closed 10 months ago

JamesGiaquinto commented 10 months ago

Hi, I worked with mustaching on the PrairieLearn project, but I guess they had other code that shortcut connecting documents. I have the key:value dictionary in .json and I'm clear on how to "{{item}}</tag" set up the template. I still get an error telling me there is no reference for mustache.js or that it's not allowed. I've looked for articles and tutorials but I'm just not getting the documents to find each other. I'm trying to find the script line to put in the or as src= but I'm just not making it work. I thought it would be as easy as

Then I would go on to the html and add {{#catalog}}

But, that's not working. It come out blank and console throws errors. I was able to use fetch() to get the .json data but that wasn't enough to make templating work.

What I want is to have all the html in .html and all the objects/data dictionary in .json. A lot of tutorials show how to just use the html file with javascript in it. Ok, I don't know how but it there is any way y'all can help me link the references together simply that would be great. I keep feeling like the answer must be right in front of my face but I can't see it. Ok, thanks for whatever help you can offer.