-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Inject files with preload and prefetch into head #532
Comments
You can already just add them to the template - Do you see any potential for auto generating them? |
@jantimon I'm not sure how much it's related, but could you maybe show a sample code how to inject e.g. fonts using |
@jamesjieye not sure what you mean by that. right now my webpack setup automatically adds script tags to the generated scripts right before the and the files have auto generated hashes in the names. it would be helpful if they are also added as preload entries before . Is that what you are talking about ? |
@szimek I guess we don't have those information on the plugin level - it would require an additional loader-plugin combination |
@jantimon the case for preload is argued well over here https://hackernoon.com/10-things-i-learned-making-the-fastest-site-in-the-world-18a0e1cdf4a7#.qkgtuk71c. this is an extreme case of course, i was just wondering how easy it might be, to emit the extra lines into head from this plugin. i thought it would be a quite straight forward optional thing to do. basically the preload goes into the , the scripts go at the bottom (also preload can potentially be used to trigger downloading dynamically added files ahead of time). scripts at the top block the render, scripts at the bottom start loading late. |
@matthiasg wow that's interesting - the html-webpack-plugin offers a hook which would allow exactly that but you would have to write a plugin to use the hook |
Hmm.. I'm trying to decide whether adding a 'resource hint' option to script-ext-html-webpack-plugin would be useful. |
When I posed the question I did not know about the templating mechanism inside which allows inserting this into head
but generally speaking, I would say that a plugin would be easier to approach and remove some potential errors. just like the html plugin emits script tags before body end by default and does not rely on templating for this either, |
@numical a new plugin would be nice and might be a great addition for https://github.com/facebookincubator/create-react-app |
@matthiasg could you please take a look and give me feedback on https://github.com/jantimon/html-resource-hints-plugin ? |
@jantimon sure. jantimon/resource-hints-webpack-plugin#1 Great work ! |
Thanks 👍 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
It would be nice if html-webpack-plugin could also generate <link rel="preload" … > and <link rel="prefetch" … > into head. Is this already possible or something that might be of interest ?
The text was updated successfully, but these errors were encountered: