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

Needs as attribute #6

Open
kurtextrem opened this issue May 4, 2017 · 1 comment
Open

Needs as attribute #6

kurtextrem opened this issue May 4, 2017 · 1 comment

Comments

@kurtextrem
Copy link

See here: https://www.smashingmagazine.com/2016/02/preload-what-is-it-good-for/#loading-of-late-discovered-resources
If the as attribute is omitted from the preload, it has lower priority or isn't even used at all (Chrome shows: was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it wasn't preloaded for nothing.

@beheh
Copy link

beheh commented Sep 29, 2017

This seems to work for me locally. The plugin is choosing the attribute based on the extension:

var preloadDirective = {
'.js': 'script',
'.css': 'style',
'.woff': 'font',
'.woff2': 'font',
'.jpeg': 'image',
'.jpg': 'image',
'.gif': 'image',
'.png': 'image',
'.svg': 'image'
};

And it's correctly set in the fixture (only for preload though - prefetch doesn't have an as attribute).

<link rel="preload" href="bundle.js" as="script"><link rel="prefetch" href="bundle.js"></head>

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

2 participants