1 min readMay 14, 2017
I think this is possible. https://www.npmjs.com/package/d3-node
But I see two problems (I’m not an expert, so I could me wrong):
- The pre-rendered html may not be any smaller in a large number of cases. Imagine how many bytes you’d need to define just one path and then multiply that by the number of data points. In such a case, it may be better to just send the data and the logic to the browser and let the browser do the work of rendering.
- Interactivity is one major appeal of d3. You don’t want to send http requests to the server every time the user initiates a change in the dom structure.
Again, I think it depends on the case. But for most cases, pre-rendering doesn’t bring much efficiency in my opinion. If I misunderstood your point, I’m happy to be corrected.