Using hierarchical markdown files to create javascript structure

I found a solution to this that works, but if someone has a better way, please chime in.

I created a plugin that accesses a php global variable, I just need to be sure to bin/grav clearcache after changes.