Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We had this 25 years ago in the form of "Server Side Includes". https://en.wikipedia.org/wiki/Server_Side_Includes

You could put something like this in your markup

    <!--#include file="footer.html" -->
And the web server would apply it and inline the contents. It had a bunch of other directives, but this was the good one.


A server side include wouldn't fix this problem because the SVG would be inlined everywhere. That defeats caching by duplicating the content.


If we're talking just SVG, it could be done as a one-time inlining that uses <defs> to define shapes, that get pulled into the page later with <use>. The defs are page-wide and work across <svg> elements. That would fix the duplication, though not necessarily caching on its own with GP's include.

https://developer.mozilla.org/en-US/docs/Web/SVG/Element/def...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: