Giter Club home page Giter Club logo

Comments (9)

jantimon avatar jantimon commented on May 8, 2024

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.

chiplay avatar chiplay commented on May 8, 2024

@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.

jantimon avatar jantimon commented on May 8, 2024

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.

chiplay avatar chiplay commented on May 8, 2024

@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.

jantimon avatar jantimon commented on May 8, 2024

Cool looks nice :)
Please note that we might deprecate templateContent for 2.0.

from html-webpack-plugin.

chiplay avatar chiplay commented on May 8, 2024

@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.

chiplay avatar chiplay commented on May 8, 2024

@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.

jantimon avatar jantimon commented on May 8, 2024

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.

lock avatar lock commented on May 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.