You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, since I wanted to have different layouts in my application, I did not want to have _document.jsx host the sprite directly and wondered if it was possible. And it seems to be working, so I am mostly curious about why the documentation states to put it in _document only? (open question).
importspritefrom'svg-sprite-loader/runtime/sprite.build';constspriteContent=sprite.stringify();exportdefaultfunctionAppLayout({ children }){return(<><divdangerouslySetInnerHTML={{__html: spriteContent}}/>{children}</>);}
I find it nice in my usecase because it does not requires getInitialProps nor does it adds the sprite to the whole document on all pages. Just on the ones I need it.
Should we update the documentation to add this possibility? Or is it a bad idea because it could fail in some cases? Let me know :)
PS: thanks for the library!
The text was updated successfully, but these errors were encountered:
Hi there, since I wanted to have different layouts in my application, I did not want to have _document.jsx host the sprite directly and wondered if it was possible. And it seems to be working, so I am mostly curious about why the documentation states to put it in _document only? (open question).
For example, this works great:
pages/dashboard.jsx
lib/AppLayout.jsx
I find it nice in my usecase because it does not requires getInitialProps nor does it adds the sprite to the whole document on all pages. Just on the ones I need it.
Should we update the documentation to add this possibility? Or is it a bad idea because it could fail in some cases? Let me know :)
PS: thanks for the library!
The text was updated successfully, but these errors were encountered: