{"bugs":{"url":"https://github.com/SimenB/add-asset-html-webpack-plugin/issues"},"dist":{"shasum":"a9cc1307ede25e91d39142185e527fa7bd25fdeb","tarball":"https://registry.npmjs.org/add-asset-html-webpack-plugin/-/add-asset-html-webpack-plugin-3.0.0-0.tgz","fileCount":8,"integrity":"sha512-F6QX6E75Yudai14Z7f/yf7hUC+hdzPKHJ+I/iHi2BdbbgxLnT24DEqbjLEqohXcEsZ9wJlpkdN2Bwkm//elW1g==","signatures":[{"sig":"MEUCIGgDCosNEEJkSYx28FuD+xP6POiWk9EPlNFh/ffepy7cAiEAnn8Fw2j1COgN/N61qa6l6sFVaX8p6M+UPxS+UFnJhsw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23166},"jest":{"testEnvironment":"node","coverageThreshold":{"global":{"lines":100,"branches":100,"functions":100,"statements":100}}},"main":"lib/index.js","name":"add-asset-html-webpack-plugin","files":["lib/","index.d.ts"],"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[![Linux & Mac Build Status][travis-image]][travis-url]\n[![Windows Build Status][appveyor-image]][appveyor-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[![Greenkeeper Dependency Status][greenkeeper-image]][greenkeeper-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@^2.10.0`.\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 the 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#### `includeSourcemap`\n\nType: `boolean`, default: `true`\n\nIf `true`, will add `filepath + '.map'` to the compilation as well.\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## Examples\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/) for an example of how to set it up. You can run it by\ncloning this repo, running `yarn` followed by `yarn run example`.\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#### 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[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[travis-url]: https://travis-ci.org/SimenB/add-asset-html-webpack-plugin\n[travis-image]: https://img.shields.io/travis/SimenB/add-asset-html-webpack-plugin/master.svg\n[appveyor-url]: https://ci.appveyor.com/project/SimenB/add-asset-html-webpack-plugin\n[appveyor-image]: https://ci.appveyor.com/api/projects/status/dim5hcl49h3pi332/branch/master?svg=true\n[codecov-url]: https://codecov.io/gh/SimenB/add-asset-html-webpack-plugin\n[codecov-image]: 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]: https://img.shields.io/david/SimenB/add-asset-html-webpack-plugin.svg\n[david-dev-url]: https://david-dm.org/SimenB/add-asset-html-webpack-plugin?type=dev\n[david-dev-image]: https://img.shields.io/david/dev/SimenB/add-asset-html-webpack-plugin.svg\n[david-peer-url]: https://david-dm.org/SimenB/add-asset-html-webpack-plugin?type=peer\n[david-peer-image]: https://img.shields.io/david/peer/SimenB/add-asset-html-webpack-plugin.svg\n[greenkeeper-url]: https://greenkeeper.io/\n[greenkeeper-image]: https://badges.greenkeeper.io/SimenB/add-asset-html-webpack-plugin.svg\n","engines":{"node":">=6"},"gitHead":"9c2e9688c5897b1b043f7bced7b8f1ed30e0c873","license":"MIT","scripts":{"lint":"eslint .","test":"jest","clean":"del-cli lib/ coverage/ example/build example/dist","cover":"jest --coverage","travis":"npm run cover","compile":"babel src/ --out-dir lib/","example":"webpack --config example/webpack.config.dll.js && webpack --config example/webpack.config.js","pretest":"npm run lint","precommit":"lint-staged","pretravis":"npm run lint && npm run clean","preexample":"npm run clean && npm run compile","prepublish":"not-in-install && npm run compile-and-update-license || in-install","preversion":"npm run travis && npm run update-license","postpublish":"git push --follow-tags","update-license":"licensor --width 72","compile-and-update-license":"npm run compile && npm 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"}}],"singleQuote":true,"trailingComma":"all"},"repository":{"url":"git+https://github.com/SimenB/add-asset-html-webpack-plugin.git","type":"git"},"_npmVersion":"5.7.1","description":"Add a JS or CSS assets to a generated HTML file","directories":{},"lint-staged":{"*.js":["eslint --fix","git add"],".eslintrc":["prettier --write","git add"],"*.{md,json}":["prettier --write","git add"]},"maintainers":[{"name":"simenb","email":"sbekkhus91@gmail.com"}],"_nodeVersion":"8.9.4","dependencies":{"globby":"^8.0.0","micromatch":"^3.1.3","p-each-series":"^1.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^22.0.0","husky":"^0.14.3","eslint":"^4.6.1","del-cli":"^1.1.0","webpack":"^4.0.0","eslint_d":"^5.1.0","licensor":"^4.0.0","prettier":"^1.8.2","babel-cli":"^6.26.0","classnames":"^2.2.5","in-publish":"^2.0.0","lint-staged":"^7.0.0","webpack-cli":"^2.0.10","babel-preset-env":"^1.6.0","html-webpack-plugin":"^3.0.4","eslint-config-simenb-base":"^14.0.0","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-transform-inline-imports-commonjs":"^1.2.0"},"peerDependencies":{"html-webpack-plugin":"^3.0.4"},"_npmOperationalInternal":{"tmp":"tmp/add-asset-html-webpack-plugin_3.0.0-0_1520065576698_0.8246558468952303","host":"s3://npm-registry-packages"},"_id":"add-asset-html-webpack-plugin@3.0.0-0","version":"3.0.0-0"}