webpack-auto-inject-version icon indicating copy to clipboard operation
webpack-auto-inject-version copied to clipboard

Add only to HTML file, not to JS bundle

Open SuhairZain opened this issue 5 years ago • 2 comments

Right now, the version and build time is injected into the HTML file and the main and vendor JS bundles. Is there a way to customize this? I can think of multiple ways to do it, but not sure which one of it this plugin supports.

  1. Specify that it should be injected only to a specific file (HTML in this case).
  2. Specify what should be injected into each file, probably by file path or file type. (In that case, we can config the plugin to output the version and build time to the HTML file, but only the version number to a JS bundle, and nothing to another bundle, for example).

SuhairZain avatar Nov 20 '18 10:11 SuhairZain

version gets added to site.webmanifest file as well (it's pwa declaration file, and idealy it should be kept clean as some browsers complain about illegal header).

Would it be possible to add option to use file/folder-path name Regex parser filter? one for include, one for ignore, like:

process: [
  "(^(\.css$|.*\.html)*$)", // match any *.css or *.html
  "(^index\.html$)" // match index.html
],
ignore: [
  "(^(.(?!.*\.css$|.*\.html))*$)", // match and ignore anything that is not *.css or *.html
  "(.*\/photos\/.*)" // match and ignore anything that is in /photos/ folder path
]

Zireael avatar Apr 26 '19 20:04 Zireael

info : InjectAsComment : match : jquery.min.js : injected : 2.0.1

should not be doing this

VividWombat avatar Mar 01 '20 10:03 VividWombat