{"bugs":{"url":"https://github.com/SimenB/add-asset-html-webpack-plugin/issues"},"dist":{"shasum":"7d1fd978ccb79d8f103cbf54fbffa96dfac94b81","tarball":"https://registry.npmjs.org/add-asset-html-webpack-plugin/-/add-asset-html-webpack-plugin-4.0.1.tgz","fileCount":6,"integrity":"sha512-kGO59goQKp6hRgRAdRqIUyXmnjqCpyFQoY8IBdOn+/REzNdTonmmG0l8F0r2dB+olmAzosJXrH+jr/MFZO0OAg==","signatures":[{"sig":"MEYCIQC3odaT9fz2eSMAH23LU/3g3PvWN7vXkjOQT6CWtfx7zwIhALMJE22bjGBCVNjhYn206cMlUYG0OMDO9e2lJnyGyFlC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20463,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiJzLOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmroFRAAhw5N6IWGnKkCFlqvtXSRPdoIlybQAr7IDCCCkBVCY+sccUWC\r\nCnGzmfK0YKn7bHARuwD0TJDmxnwCYRlB1w1eXvUU2si2JcbOK8Vs62lOObNp\r\ni/ZUE8nEysTZIMgTd5lsyyjjczSwfCzGvuXzipPACFdxeULX5C96xph+iQ7X\r\nzIQN752njGoU6MR30uXRrC8Yee7xED9kqr8+PKCL10tIybrIAdVabIPagJxY\r\neHUn6eW3FGewDB33fBX8el1rqg5giUVmHoYzUESwuFGyXDUgcWQtCqo1XxO2\r\ni2LpSuThWJiBCEmuoekG9M2heRp++Ftrsr2nFzghBW4TRuWoRWI+gwmt/kM8\r\nOnXOSPs0HNZmHymwyy7PVZk/RPva1LqezeZDgW4IHxnSOBTMqzCjB077Ou4Z\r\nW5F/YqrnTQ8QgNWTLTT+IeyHKvznZqiNX14Pg5wdB0+pHvxu7+P1kEsyuKAA\r\nna+ViqSvzpugBGvZNR9mo918cXAgazMMWr43WVsvogl1qkLao7By+QPnDq62\r\n8OoJOcr3CFVJtoMQQzGLnO98TZLy0frIi6dF9P7xhAtOYszOXyR+tfuFxaDp\r\nYvWw3pFYda8ugjmFlHgsJFcGowwf2HQYrwP/Wmbd06hcTmcQK6s7Q0a0SEEn\r\ngDpniZja4vBqTHeTmlY6aWkf5BZizwBn1QQ=\r\n=9l1G\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"transform":{},"watchPlugins":["jest-watch-typeahead/filename","jest-watch-typeahead/testname"],"testEnvironment":"node","coverageThreshold":{"global":{"lines":100,"branches":100,"functions":100,"statements":100}}},"main":"src/index.js","name":"add-asset-html-webpack-plugin","author":{"name":"Simen Bekkhus","email":"sbekkhus91@gmail.com"},"readme":"# add-asset-html-webpack-plugin\n\n> Add a JavaScript or CSS asset to the HTML generated by `html-webpack-plugin`\n\n[![NPM Version][npm-image]][npm-url]\n[![CI Build Status][gh-actions-image]][gh-actions-url]\n[![Code Coverage branch][codecov-image]][codecov-url]\n\n[![Dependency Status][david-image]][david-url]\n[![Dev Dependency Status][david-dev-image]][david-dev-url]\n[![Peer Dependency Status][david-peer-image]][david-peer-url]\n\n## Installation\n\nInstall the plugin with `npm`:\n\n```sh\n$ npm i add-asset-html-webpack-plugin -D\n```\n\nNOTE: This plugin requires `html-webpack-plugin@^3`, `html-webpack-plugin@^4`,\nor `html-webpack-plugin@^5`.\n\n## Basic Usage\n\nThe plugin will add the given JS or CSS file to the files Webpack knows about,\nand put it into the list of assets `html-webpack-plugin` injects into the\ngenerated html. Add the plugin to your config, providing it a filepath:\n\n```js\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');\nconst webpackConfig = {\n  entry: 'index.js',\n  output: {\n    path: 'dist',\n    filename: 'index_bundle.js',\n  },\n  plugins: [\n    new HtmlWebpackPlugin(),\n    new AddAssetHtmlPlugin({ filepath: require.resolve('./some-file') }),\n  ],\n};\n```\n\nThis will add a script tag to the HTML generated by `html-webpack-plugin`, and\nlook like:\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"UTF-8\" />\n    <title>Webpack App</title>\n  </head>\n  <body>\n    <script src=\"index_bundle.js\"></script>\n    <script src=\"some-file.js\"></script>\n  </body>\n</html>\n```\n\nNOTE: You can also pass an array of assets to be added. Same API as mentioned\nbelow, just pass multiple objects as an array.\n\n```js\nnew AddAssetHtmlPlugin([\n  { filepath: require.resolve('./some-file') },\n  { filepath: require.resolve('./some-other-file') },\n  // Glob to match all of the dll file\n  { filepath: require.resolve('./**/*.dll.js') },\n]);\n```\n\n## Options\n\nOptions are passed to the plugin during instantiation.\n\n```js\nnew AddAssetHtmlPlugin({ filepath: require.resolve('./some-file') });\n```\n\n#### `filepath`\n\nType: `string|Glob`, mandatory\n\nThe absolute path of the file you want to add to the compilation, and resulting\nHTML file. Also support globby string.\n\n#### `files`\n\nType: `string|Array<string>`, default `[]\n\nFiles that the assets will be added to.\n\nBy default the assets will be included in all files. If files are defined, the\nassets will only be included in specified file globs.\n\n#### `hash`\n\nType: `boolean`, default: `false`\n\nIf `true`, will append a unique hash of the file to the filename. This is useful\nfor cache busting.\n\n#### `includeRelatedFiles`\n\nType: `boolean`, default: `true`\n\nIf `true`, will add `filepath + '.*'` to the compilation as well. E.g\n`filepath.map` and `filepath.gz`.\n\n#### `outputPath`\n\nType: `string`\n\nIf set, will be used as the output directory of the file.\n\n#### `publicPath`\n\nType: `string`\n\nIf set, will be used as the public path of the script or link tag.\n\n#### `typeOfAsset`\n\nType: `string`, default: `js`\n\nCan be set to `css` to create a `link`-tag instead of a `script`-tag.\n\n#### `attributes`\n\nType: `object`, default: `{}`\n\nExtra attributes to be added to the generated tag. Useful to for instance add\n`nomodule` to a polyfill script. The `attributes` object uses the key as the\nname of the attribute, and the value as the value of it. If value is simply\n`true` no value will be added.\n\nAn example of this is included in the repository.\n\nCurrently only supports script tags.\n\n## Examples\n\nWhen adding assets, it's added to the start of the array, so when\n`html-webpack-plugin` injects the assets, it's before other assets. If you\ndepend on some order for the assets beyond that, and ordering the plugins\ndoesn't cut it, you'll have to create a custom template and add the tags\nyourself.\n\n### Add a DLL file from `webpack.DllPlugin`\n\nNote: Remember to build the DLL file in a separate build.\n\nSee [example](example/dll/) for an example of how to set it up. You can run it\nby cloning this repo, running `yarn` followed by `yarn run example`.\n\n#### Webpack config\n\n```js\nconst path = require('path');\nconst webpack = require('webpack');\nconst webpackConfig = {\n  entry: {\n    vendor: ['react', 'redux', 'react-router'],\n  },\n  devtool: '#source-map',\n  output: {\n    path: path.join(__dirname, 'build'),\n    filename: '[name].dll.js',\n    library: '[name]_[hash]',\n  },\n  plugins: [\n    new webpack.DllPlugin({\n      path: path.join(__dirname, 'build', '[name]-manifest.json'),\n      name: '[name]_[hash]',\n    }),\n  ],\n};\n```\n\nYour main build:\n\n```js\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');\nconst webpackConfig = {\n  entry: 'index.js',\n  output: {\n    path: 'dist',\n    filename: 'index_bundle.js',\n  },\n  plugins: [\n    new webpack.DllReferencePlugin({\n      context: path.join(__dirname),\n      manifest: require('./build/vendor-manifest.json'),\n    }),\n    new HtmlWebpackPlugin(),\n    new AddAssetHtmlPlugin({\n      filepath: path.resolve(__dirname, './build/*.dll.js'),\n    }),\n  ],\n};\n```\n\n### Add a polyfill file you have locally\n\nSee [example](example/polyfill/) for an example of how to use it. You can run it\nby cloning this repo, running `yarn` followed by `yarn run example`.\n\n#### Webpack config\n\n```js\nconst path = require('path');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst AddAssetHtmlPlugin = require('../../');\n\nconst webpackConfig = {\n  entry: 'entry.js',\n  devtool: '#source-map',\n  mode: 'development',\n  output: {\n    path: 'dist',\n    filename: 'index_bundle.js',\n  },\n  plugins: [\n    new HtmlWebpackPlugin(),\n    new AddAssetHtmlPlugin({\n      filepath: path.resolve(__dirname, './polyfill.js'),\n      attributes: {\n        nomodule: true,\n      },\n    }),\n  ],\n};\n```\n\n[npm-url]: https://npmjs.org/package/add-asset-html-webpack-plugin\n[npm-image]: https://img.shields.io/npm/v/add-asset-html-webpack-plugin.svg\n[gh-actions-url]:\n  https://github.com/SimenB/add-asset-html-webpack-plugin/actions/workflows/node.js.yml\n[gh-actions-image]:\n  https://github.com/SimenB/add-asset-html-webpack-plugin/actions/workflows/node.js.yml/badge.svg?branch=main\n[codecov-url]: https://codecov.io/gh/SimenB/add-asset-html-webpack-plugin\n[codecov-image]:\n  https://img.shields.io/codecov/c/github/SimenB/add-asset-html-webpack-plugin/master.svg\n[david-url]: https://david-dm.org/SimenB/add-asset-html-webpack-plugin\n[david-image]:\n  https://img.shields.io/david/SimenB/add-asset-html-webpack-plugin.svg\n[david-dev-url]:\n  https://david-dm.org/SimenB/add-asset-html-webpack-plugin?type=dev\n[david-dev-image]:\n  https://img.shields.io/david/dev/SimenB/add-asset-html-webpack-plugin.svg\n[david-peer-url]:\n  https://david-dm.org/SimenB/add-asset-html-webpack-plugin?type=peer\n[david-peer-image]:\n  https://img.shields.io/david/peer/SimenB/add-asset-html-webpack-plugin.svg\n","engines":{"node":"^12.13.0 || ^14.15.0 || >=16.0.0"},"gitHead":"f8038adec0e045c5ae874c0f1a0af99f78ade2b8","license":"MIT","release":{"branches":["main","4.x"]},"scripts":{"lint":"eslint --cache .","test":"jest","clean":"del-cli lib/ coverage/ \"example/*/build\" \"example/*/dist\"","cover":"yarn run test --coverage","example":"yarn run clean && yarn run example:dll && yarn run example:polyfill","prepack":"pinst --disable","postpack":"pinst --enable","example:dll":"webpack --config example/dll/webpack.config.dll.js && webpack --config example/dll/webpack.config.js","postinstall":"husky install","update-license":"licensor --width 72","example:polyfill":"webpack --config example/polyfill/webpack.config.js","build-and-update-license":"yarn run update-license"},"_npmUser":{"name":"simenb","email":"sbekkhus91@gmail.com"},"homepage":"https://github.com/SimenB/add-asset-html-webpack-plugin#readme","keywords":["dll","html-webpack-plugin","webpack"],"prettier":{"overrides":[{"files":".eslintrc","options":{"parser":"json"}},{"files":"lib/**/*.js","options":{"trailingComma":"es5"}},{"files":".github/workflows/**/*.yml","options":{"printWidth":175}}],"proseWrap":"always","arrowParens":"avoid","singleQuote":true,"trailingComma":"all"},"repository":{"url":"git+https://github.com/SimenB/add-asset-html-webpack-plugin.git","type":"git"},"_npmVersion":"7.20.6","description":"Add a JS or CSS assets to a generated HTML file","directories":{},"lint-staged":{"*.{js,ts}":"eslint --fix --cache",".eslintrc":"prettier --write","*.{md,json}":"prettier --write"},"maintainers":[{"name":"simenb","email":"sbekkhus91@gmail.com"}],"resolutions":{"@semantic-release/npm/npm":"7.20.6"},"_nodeVersion":"16.14.0","dependencies":{"globby":"^9.2.0","micromatch":"^4.0.4"},"_hasShrinkwrap":false,"packageManager":"yarn@3.2.0","readmeFilename":"README.md","devDependencies":{"jest":"^27.0.0","husky":"^7.0.0","pinst":"^3.0.0","slash":"^3.0.0","eslint":"^8.10.0","del-cli":"^4.0.1","express":"^4.17.1","webpack":"^5.23.0","licensor":"^4.0.0","prettier":"^2.2.1","puppeteer":"^13.5.0","stoppable":"^1.1.0","classnames":"^2.2.5","lint-staged":"^12.3.5","webpack-cli":"^4.5.0","semantic-release":"^19.0.2","html-webpack-plugin":"^5.2.0","jest-watch-typeahead":"^1.0.0","eslint-config-simenb-base":"^15.0.1"},"peerDependencies":{"webpack":"^4.0.0 || ^5.0.0","html-webpack-plugin":"^3.0.4 || ^4.0.0-0 || ^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/add-asset-html-webpack-plugin_4.0.1_1646736077975_0.33113917624294653","host":"s3://npm-registry-packages"},"_id":"add-asset-html-webpack-plugin@4.0.1","version":"4.0.1"}