{"name":"mini-html-webpack-plugin","version":"3.0.5","description":"A miniature version of html-webpack-plugin with only necessary features","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prepublishOnly":"npm run build","build":"rimraf ./dist && tsc","watch":"tsc --watch","pretest":"npm run lint","test":"npm run test:jest","posttest":"npm run format","lint":"eslint **/*.ts --cache --fix --ignore-path .gitignore","format":"prettier --write \"**/*.{ts,md}\"","test:jest":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage"},"keywords":["webpack","html","template"],"author":{"name":"Juho Vepsalainen"},"contributors":[{"name":"Artem Sapegin","url":"http://sapegin.me"}],"license":"MIT","dependencies":{"webpack-sources":"^1.4.3"},"homepage":"https://github.com/styleguidist/mini-html-webpack-plugin","repository":{"type":"git","url":"git+https://github.com/styleguidist/mini-html-webpack-plugin.git"},"engines":{"node":">=10"},"devDependencies":{"@types/jest":"^25.1.4","@types/mini-css-extract-plugin":"^0.9.1","@types/webpack":"^4.41.10","@types/webpack-sources":"^0.1.7","@typescript-eslint/eslint-plugin":"^2.26.0","@typescript-eslint/parser":"^2.26.0","@webpack-contrib/test-utils":"^0.1.3","css-loader":"^3.4.2","eslint":"^6.8.0","eslint-config-tamia":"^7.1.2","husky":"^4.2.3","jest":"^25.2.4","lint-staged":"^10.1.0","mini-css-extract-plugin":"^0.9.0","prettier":"^2.0.2","rimraf":"^3.0.2","ts-jest":"^25.3.0","typescript":"^3.8.3","webpack":"^4.42.1"},"peerDependencies":{"webpack":">=4"},"lint-staged":{"*.{ts,md}":["prettier --write"],"*.ts":["eslint --fix"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"868d145176f83b1f4025d92023a5b84d2e64c791","bugs":{"url":"https://github.com/styleguidist/mini-html-webpack-plugin/issues"},"_id":"mini-html-webpack-plugin@3.0.5","_nodeVersion":"11.15.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-rB5fJvSh8XXHYaO0eBphzwbGGdjYH3v9YUZrm1ShkIN260rrG0UtonroEGVRpBA5iLWFb8LE0yO8J4HbYvIZ9w==","shasum":"966de70725a681f988d83d5576e8e7dcc4adf7bc","tarball":"http://registry-npm.ywwl.com/mini-html-webpack-plugin/download/mini-html-webpack-plugin-3.0.5.tgz","fileCount":5,"unpackedSize":14128,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJehgoECRA9TVsSAnZWagAADdcP/0iuxs4R4/xiq6CT72wY\nnurN7ehHK76mLuAxsjcZlddegjmAvs9ZjFMMP/uhs2/D0/D7GE+yW1HmvgI1\n3C+0qlyZHrSkXo4KOpNlbJxbRKdHJBDPSuPd5k1Hijtd/L65Gb00HxFhKYpo\nuG2EB1DlgYdIu+5Ehg7i510YG/7ELDJH5aB7LkzeJ+ylLPMg9q3vLvRM/ejy\nJ2sIvJtgPcwwilJge04nzRaw1Bm4BBYaqrnaAbpQSvypYTHHA+SYgoTU5jhR\nzDDApnt/vraQHQIWBtmW2dTCdEwL/mSrHe2oF8TRXQrKbPzfal/Lr/PR97tB\n/yeB5Sh5bpCjlnr4YIp1Xio+r6BB2aIA2SD4kcw357CWYE9TqfFLLOYPvUVP\nbz6vX9NoLCQQhvzyhetT7B2i0gl4rjALFYmiosI3ce6me2/aYCqt15mB40Dy\nIS33cCHuuL8DdbBpL2Qlztv/ddhWZMUcJMCKRYbyOgA1akJ4Om0kX+i3MIbt\ntqlpb/8qzewwJyhXA7cs2br5A8R9ei5DZE1nrwAYFB9CYVn4FUNPBVZiS0nY\nUmlQQdiFPQHkHDFY2sxdcFu8R2MfXn4GAzEamPB7AMrSuLTWcW8bbd40STl+\nlHsYwuMU956xSlFSOkdvaPptb7T3wJHntwTXVv7MMyvFZJ5UUXP5voq0vrjl\n/8Gl\r\n=0+0G\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDrnhR0Segrezk1eIuS0C3GigiYQtb0cEz6Y2y1XopY8gIhAMRadGeJjDfm3UQspfZFpYVSxJ8edoiVAGQZDb6IAJBR"}],"size":4664,"noattachment":false,"key":"/mini-html-webpack-plugin/-/mini-html-webpack-plugin-3.0.5.tgz"},"maintainers":[{"email":"bebraw@gmail.com","name":"bebraw"},{"email":"artem@sapegin.ru","name":"sapegin"}],"_npmUser":{"name":"sapegin","email":"artem@sapegin.ru"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mini-html-webpack-plugin_3.0.5_1585842691880_0.42583209230984"},"_hasShrinkwrap":false,"readme":"# mini-html-webpack-plugin: a miniature version of html-webpack-plugin with only necessary features\n\n[![npm](https://img.shields.io/npm/v/mini-html-webpack-plugin.svg)](https://www.npmjs.com/package/mini-html-webpack-plugin) [![Build Status](https://travis-ci.org/styleguidist/mini-html-webpack-plugin.svg)](https://travis-ci.org/styleguidist/mini-html-webpack-plugin)\n\nThe plugin writes CSS and JS asset paths for you automatically. It works with webpack 4 or higher.\n\n**It does not work with html-webpack-plugin plugins!**\n\n## Usage\n\n```sh\nnpm install mini-html-webpack-plugin\n```\n\n```javascript\nconst { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin');\n\nconst config = {\n  plugins: [\n    new MiniHtmlWebpackPlugin({\n      // Optional, defaults to `index.html`\n      filename: 'demo.html',\n      // Optional\n      publicPath: 'demo/',\n      context: {\n        title: 'Webpack demo',\n        // Optional, defaults to `{ lang: 'en' }`\n        htmlAttributes: {\n          lang: 'en'\n        },\n        // Optional, any additional HTML attached within <head>\n        head: '',\n        // Optional, any additional HTML attached within <body>\n        body: '',\n        // Optional\n        cssAttributes: {\n          rel: 'preload',\n          as: 'style'\n        },\n        // Optional\n        jsAttributes: {\n          defer: true\n        }\n      },\n      // Optional, use this for choosing chunks to include to your page.\n      // See the expanded example below.\n      chunks: ['app']\n    })\n  ]\n};\n```\n\n### Multiple pages\n\nIt's possible to use `MiniHtmlWebpackPlugin` to develop sites with multiple pages. It can be combined with webpack's bundle splitting so you can share common code across different pages.\n\nTo achieve this, you'll have to define `entry` against each the code for each page and define `MiniHtmlWebpackPlugin` to match them. In practice you might want to abstract this pairing but to give you the full idea, consider the example below.\n\n```javascript\nconst { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin');\n\nconst config = {\n  entry: {\n    app: './app.js',\n    another: './another.js'\n  },\n  plugins: [\n    new MiniHtmlWebpackPlugin({\n      filename: 'index.html',\n      chunks: ['app'],\n    }),\n    new MiniHtmlWebpackPlugin({\n      filename: 'another.html',\n      chunks: ['another'],\n    },\n  ],\n};\n```\n\n### HTML minification\n\n```javascript\nconst minify = require('html-minifier').minify;\nconst { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin');\n\nconst config = {\n  plugins: [\n    new MiniHtmlWebpackPlugin({\n      context: {\n        title: 'Minification demo'\n      },\n      template: (context) =>\n        minify(MiniHtmlWebpackPlugin.defaultTemplate(context))\n    })\n  ]\n};\n```\n\n### Custom templates\n\nUse [@vxna/mini-html-webpack-template](https://www.npmjs.com/package/@vxna/mini-html-webpack-template) to add an app container div, a favicon, meta tags, inline JavaScript or CSS.\n\nOr define a template function to generate your own code.\n\nThe template function may return a string or a `Promise` resolving to a string.\n\n```js\nconst {\n  MiniHtmlWebpackPlugin,\n  generateAttributes,\n  generateCSSReferences,\n  generateJSReferences\n} = require('mini-html-webpack-plugin');\n\nconst config = {\n  plugins: [\n    new MiniHtmlWebpackPlugin({\n      filename: 'demo.html',\n      publicPath: 'demo/',\n      // `context` is available in `template` below\n      context: {\n        title: 'Webpack demo',\n        htmlAttributes: {\n          lang: 'en'\n        },\n        cssAttributes: {\n          rel: 'preload',\n          as: 'style'\n        },\n        jsAttributes: {\n          defer: true\n        }\n      },\n      template: ({\n        css,\n        js,\n        publicPath,\n        title,\n        htmlAttributes,\n        cssAttributes,\n        jsAttributes\n      }) => {\n        const htmlAttrs = generateAttributes(htmlAttributes);\n\n        const cssTags = generateCSSReferences({\n          files: css,\n          attributes: cssAttributes,\n          publicPath\n        });\n\n        const jsTags = generateJSReferences({\n          files: js,\n          attributes: jsAttributes,\n          publicPath\n        });\n\n        return `<!DOCTYPE html>\n        <html${htmlAttrs}>\n          <head>\n            <meta charset=\"UTF-8\">\n            <title>${title}</title>\n            ${cssTags}\n          </head>\n          <body>\n            ${jsTags}\n          </body>\n        </html>`;\n      }\n    })\n  ]\n};\n```\n\n## License\n\nMIT.\n","publish_time":1585842691969,"_cnpm_publish_time":1585842691969,"dist-tags":{"latest":"3.1.3"}}