Riot.js dynamically creates nested user tags from different files on the server side

I am trying to use server-side rendering of riot.js to make a static HTML page that could be read by google spiders. I have a basic work example, but I'm trying to figure out how to dynamically load tags from different files when rendering on the server.

I understand that if you β€œrequire” each tag file, it will work, but there must be a way to detect and find tags from the main tag file.

for example, given this tag stored in "home.tag":

<home>
      <foo></foo>
      <bar></bar>
</home>

when I require "home.tag", I would think that it would be better to include the files "foo.tag" and "bar.tag" automatically without the need to individually require each of them. Any help would be greatly appreciated!

+4
source share
1 answer

require-all may allow you to simply require all the files .tagin the template directory. It would be convenient if riotjs just understood what tag files are needed, but considering how node.js and riotjs should play with each other, I think it's better if you explicitly require .tag files, wherever they look for them, if you yourself did not demand them? How to resolve conflicts?

0
source

All Articles