Created
July 5, 2017 19:04
-
-
Save vamsiampolu/144a05c1e2c139dacc1c75aaec311063 to your computer and use it in GitHub Desktop.
Server rendering svg sprite loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sprite from 'svg-sprite-loader/runtime/sprite.build'; | |
const spriteContent = sprite.stringify(); | |
// Your express app goes here | |
// Good luck with the rest of the server rendered configuration | |
res.send(` | |
<!DOCTYPE html> | |
<head> | |
<!-- add all your stylesheets and other stuff here, use the styled-components plugin, that is very powerful --> | |
</head> | |
<body> | |
<!-- Icons YAY!! --> | |
${svg} | |
<!-- the whole point of server rendering --> | |
<div id="root">${app}</div> | |
</body> | |
`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment