XF 2.0 Vue.js and Mustache

adamsmasher

Active member
I'm working on an add-on that is using Vue.js to for a reactive form. I was initially doing this in XF1 but decided not to spend more time on that as I think we will migrate to XF2 before I'll finish, so I might as well only make it for XF2. A wrinkle that I had forgotten about is that XF2 uses mustache tags with the same format as Vue. XF will naturally see any Vue mustache tags as an XF tag. Is there a way I can make it ignore these? I haven't been able to find out whether there was something I could wrap these with to make XF ignore them.

Thanks!
 
I found a way around it although it's not the most elegant solution. If I move the template code that includes Vue mustach tags to my PHP class and bring into the template from there, I can print it out with {$variable|raw}.
 
If you have no server side stuff to insert within your template code, you can wrap it in <xf:plain> tags and you'll just disable all parsing within that.

Otherwise, we do have a fairly verbose <xf:mustache> tag and {{ mustache(...) }} function to help output the Mustache format. You can see this used in helper_attach_upload.
 
Top Bottom