What are the benefits of improving website performance?

I stumbled upon this post while working on a NationBuilder site (which also use Liquid Templates) and trying to figure out how to pull a CSRF token out of {{ content_for_header }} because I wanted to embed a form on a non-form page. Because NationBuilder is woefully behind the times, I’m basically not using any of their pre-packaged header content, except for the CSRF token.

So far, the best solution I found to plucking a single piece of content out of the {{ content_for_header }} code, without it actually loading any of the scripts/styles into memory, is to write the {{ content_for_header }} into a tag; which basically renders it all as a string. Then use a JS regex match to pull out the CSRF Token and set it in the actual CSRF metatag in the actual head, then delete the node.

…which is completely ridiculous and circuitous way of achieving something which should be rather trivial. But hey, that’s NationBuilder in a nutshell.

Anyway, I hope this helps someone in the future.

1 Like