Comments (9)
Do you have an example project with this plugin?
It works with https://github.com/lettertwo/appcache-webpack-plugin/ out of the box
from html-webpack-plugin.
@jantimon I'm working on trying to integrate both right now and stumbling through it. From what I can tell, chunk-manifest-webpack inserts a manifest.json file (not appcache) into the compilation.assets object, then its my job to insert that json into a window.webpackManifest
variable (which I'd love to do dynamically using html-webpack). It seems like I have access to a subset of the compilation.assets via htmlWebpackPlugin.files
- but not all of them - eg. htmlWebpackPlugin.files.all = compilation.assets
- which would probably do the trick, so that I could use htmlWebpackPlugin.files.all['manifest.json']
in my template. Thoughts?
Is there another plugin that solves the same problem of extracting the module mapping out of the common chunk bundle so that I can do longterm chuckHash file caching?
from html-webpack-plugin.
Actually it should be part of o.webpack
if not it shouldn't hurt to set files.compilationAssets
to compilation.assets.
from html-webpack-plugin.
@jantimon it looks like o.webpack
is webpack: webpackStatsJson
which is from var webpackStatsJson = compilation.getStats().toJson();
. From that object, I found it rather difficult to get to the manifest.json source
content. But, after some hacking, I was able to solve it with this quick fix:
templateContent: function(templateParams, compilation) {
var fn = jade.compileFile(path.resolve('./app/index.jade'));
templateParams.manifest = compilation.assets['manifest.json']._value;
return fn(templateParams);
}
Hope this helps someone else!
from html-webpack-plugin.
Cool looks nice :)
Please note that we might deprecate templateContent
for 2.0.
from html-webpack-plugin.
@jantimon what would be the replacement for templateContent
? I'd love to go ahead and set it up correctly now while I'm at it.
from html-webpack-plugin.
@jantimon I saw your progress on the 2.0 branch/PR - awesome work! Are you going to implement a replacement for templateContent? I saw chatter about a pre/postProcess step, but wasn't sure if that made the cut. Thanks!
from html-webpack-plugin.
Actually I would like to trigger an event but haven't looked into that.
This would allow to integrate other plugins more easily.
from html-webpack-plugin.
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.
from html-webpack-plugin.
Related Issues (20)
- Unable to include a static JS file (generated hashed filename does not match the one in the index.html) HOT 2
- The packaged js content is directly inserted into the generated template
- templateContent function did not get headTags added in afterTemplateExecution HOT 1
- Insert just defer, not defer=defer HOT 1
- Ability to pass extra plugins to the child compilation HOT 5
- Ability to escape relative urls HOT 1
- How to bundle all of app's templates, styles and scripts into one single .js file, that can be exported as a library and attached to another HTML file and load?
- Is it possible to inject HTML code built from `.ejs` template into js while building and bundling with webpack? HOT 3
- Request sitemap.txt generation HOT 5
- Pre release libraries not working
- Don't update static link file in template.html HOT 1
- Writing Your Own Templates section does not work HOT 2
- ```[tasklist] ### My tasks - [ ] https://github.com/octo-org/octo-repo/issues/45 - [ ] Draft task ```
- Embed the script into HTML HOT 3
- Add a link rel=prefetch for a css chunks created within your wepbackPrefetch lazy loaded js chunks HOT 2
- Watch mode memory leak when saving HTML template HOT 1
- multi-page behavior illogical? HOT 1
- Memory leak in watch mode due to unique child compiler IDs HOT 1
- New version 5.6.0 introduce breaking changes to the plugin interface HOT 3
- CSS order not correct when using split chunks HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-webpack-plugin.