{"name":"mini-html-webpack-plugin","version":"0.2.1","description":"A miniature version of html-webpack-plugin with less functionality","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["webpack"],"author":{"name":"Juho Vepsalainen"},"license":"MIT","dependencies":{"webpack-sources":"^1.1.0"},"repository":{"type":"git","url":"git+ssh://git@github.com/bebraw/mini-html-webpack-plugin.git"},"bugs":{"url":"https://github.com/bebraw/mini-html-webpack-plugin/issues"},"gitHead":"c9df8843dc1b99413f222bec42dc53c49fa47c88","homepage":"https://github.com/bebraw/mini-html-webpack-plugin#readme","_id":"mini-html-webpack-plugin@0.2.1","_npmVersion":"5.8.0","_nodeVersion":"8.9.1","_npmUser":{"name":"sapegin","email":"artem@sapegin.ru"},"dist":{"integrity":"sha512-DMMKdUm7lL/Cn72WZl2R72xJYzipce301kVlAukRYQWYV/yZLGLZ9rD6vSnKkx5tPXlRUnZMo13mt1SZ8ifJwg==","shasum":"568da3f9b57ac05fa82be2467c777825d8574226","tarball":"http://registry-npm.ywwl.com/mini-html-webpack-plugin/download/mini-html-webpack-plugin-0.2.1.tgz","fileCount":3,"unpackedSize":4594,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGPcFauDSjhSfRdlIl5u8YshAfzxkx3OHuHLdQxwuYo8AiB2gmNm7Oj/q6czhgfdXDj8pcKovm9JBm7exldTrZY7zA=="}],"size":1727,"noattachment":false,"key":"/mini-html-webpack-plugin/-/mini-html-webpack-plugin-0.2.1.tgz"},"maintainers":[{"email":"bebraw@gmail.com","name":"bebraw"},{"email":"artem@sapegin.ru","name":"sapegin"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mini-html-webpack-plugin_0.2.1_1522355837461_0.35185368221950175"},"_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":1522355837518,"_cnpm_publish_time":1522355837518,"dist-tags":{"latest":"3.1.3"}}