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
Automatically add JS/CSS to HTML files for CDN resources #754
Comments
This propably can be part of https://github.com/ampedandwired/html-webpack-plugin |
+1 |
Motivation: http://stackoverflow.com/a/558494/14731 |
@sokra I filed a feature request against html-webpack-plugin, but I just want to point out that it is an extremely low-volume plugin. I don't expect them to implement this (or any other new feature) anytime soon. Anyway, in the meantime I will do my best to drum up support for this feature request. |
This issue is related to #536 |
I would also like this. There doesn't seem to be a hook to implement something like this (I'm new to webpack though so could be missing it). Other features I want (either by configuration or a hook):
|
👍 |
I believe the relevant issue is jantimon/html-webpack-plugin#12 |
👍 |
1 similar comment
👍 |
I read through the thread, and the html-webpack-plugin#12, has the feature description in @cowwoc been implemented? |
@dongpei021 I'm not using webpack at the moment so I can't check, but at first glance it looks like it might do it. I've asked the guys over at #536 to review it. |
Another solution is webpack-cdn-plugin |
Hey! Take a look at this one autoloader-cdn |
Currently, when loading resources from CDNs, you need to manually add
<script>
and<link>
tags to the HTML file,exports
to the Webpack configuration andrequire()
to the code that uses it. This is error prone for transitive dependencies (users may forget to add a<script>
or<link>
tag). Example:index.html
depends onindex.js
which depends onchunk.js
which depends onjquery.js
. The author ofindex.js
may forget to add<script>
and<link>
tags forchunk.js
's dependencies. This quickly gets out of hand as soon as dependencies have their own dependencies.The fact that
chunk.js
invokesrequire('./jquery.js')
should cause a<script type='text/javascript' src='cdn/jquery.js'>
to get added toindex.html
on their behalf. Similarly, the fact thatchunk.js
invokesrequire('./jquery.css')
should cause a<link rel='stylesheet' type='text/css' href='cdn/jquery.css'/>
to get added on their behalf.In an ideal world I'd tell webpack (at build-time) what scripts to load asynchronously, but then have
require('foo')
resolve synchronously at runtime, and have the library loaded without exporting globals. I'm not fixated on any particular implementation details.The text was updated successfully, but these errors were encountered: