Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse <link> preloader elements #35

Open
BynariStar opened this issue Feb 23, 2018 · 0 comments
Open

Parse <link> preloader elements #35

BynariStar opened this issue Feb 23, 2018 · 0 comments

Comments

@BynariStar
Copy link

BynariStar commented Feb 23, 2018

I'm currently trying to have my app preload font files and background images, and I haven't found an ideal way to do so with Netjet.

Currently, the only way I've found to get Netjet to parse background images is to just shove <img src="image.jpg" style="display: none;"> into my DOM. And when it comes to fonts, I have to manually append a header to the route response, forgoing Netjet entirely.

The simplest solution seems to be to parse link preloaders from the DOM, giving you easy control of specific elements you want preloaded on each page without resorting to hackery.

For example, the following elements would be parsed:
<link rel="preload" href="image.jpg" as="image">
<link rel="preload" href="font.woff" as="font">

This would also open the door to other types of files being preloaded, such as audio and video, given they're small enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant