{"name":"mini-html-webpack-plugin","version":"1.0.0","description":"A miniature version of html-webpack-plugin with only necessary features","main":"index.js","scripts":{"pretest":"npm run lint","test":"true && npm run test:jest","posttest":"npm run format","lint":"eslint . --cache --fix","format":"prettier --write \"**/*.{js,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.3.0"},"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":">=8.12"},"devDependencies":{"@webpack-contrib/test-utils":"^0.1.3","eslint":"^5.16.0","eslint-config-tamia":"^6.0.2","husky":"^2.3.0","jest":"^24.8.0","lint-staged":"^8.1.7","prettier":"^1.17.1","webpack":"^4.31.0"},"lint-staged":{"*.{js,md}":["prettier --write","git add"],"*.js":["eslint --fix","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"gitHead":"97e53f5d6f54b46edde16979f8d4837616d965bd","bugs":{"url":"https://github.com/styleguidist/mini-html-webpack-plugin/issues"},"_id":"mini-html-webpack-plugin@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.16.0","_npmUser":{"name":"sapegin","email":"artem@sapegin.ru"},"dist":{"integrity":"sha512-4VBXB8B4UiD6bRdnIHtHnuQRO64LAQ9A970O+X+/MCII1c+nn5Qi0rpT40a23sSzfnOWxm8RUplbn6M8pU9RbQ==","shasum":"9e5b9bd7c5ce504856008e979c738de44805dd48","tarball":"http://registry-npm.ywwl.com/mini-html-webpack-plugin/download/mini-html-webpack-plugin-1.0.0.tgz","fileCount":4,"unpackedSize":7316,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3lr9CRA9TVsSAnZWagAABTcP/3veN9TSc4qUYFG7gYxF\nZ8uh8/zqfKudMWwbmI8/1JJVtSAMe8YbbFWnY6RFfjeW2U5f6cqNbbU2El6Q\nMiPmZo4HtoXgXAFTST+fTiPxW9aY31hmyLfyqYxG6/ZNY1NpiYPrbIjMhCnw\nczuDND72P6GhXNag+HK2qunNmYI1x0hJaM6rikphz0Wq26Cf8j+4lnQA7JAd\naOrk0QBGfbZAPlf4r8JFyg4mMmJlXkCyXnnttj724DHtJsPFTXuaQHHuZS3Y\n95dEkrWBeUfz+4yUdwFFGqFPEApULtelo5l8A+CXzu7/MVBQuUEXergTpCgw\nmBirx/6kceUm9XTm3bQXvS6jVVkHbGPMSa4Rv04FSBbTLHCi/EvDiNvI0w0V\n4OWWFJQYdzs+tgnNr9RenDci3N+9aMQ49W5kwOQOqSs8fDfwON/FEOB/OqTg\nedrh+21QRNNfE9SUmjPxXK7V0Le+0j6Ewe8LYwcry+B4JGYTuamXjc9d+RYM\nto/xd62a6lhXbjLuV/NZQQopY/ZUNil++kB8Ai+JIQn+atx/axoe3qiyhvPz\nFkOHRMOIZxvo73JB7dDQbK41zoYAiE3UXS8u/xj3WO7vZCZw5vBDiQ60COBw\nmOcAbP63UnqFxu2G2kTujMmduBSjQCfcjxAu0m4jIreSj5mEVG4GrComaU9n\nxMuk\r\n=16yG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDkkj8W+xejmpbf00cczDEfNmqxN2eCg1CM0xe7YfnHAIhALGckqPMIDTelxQW90I1PoRHHt1mYeLOaXF6vF0jRelx"}],"size":2925,"noattachment":false,"key":"/mini-html-webpack-plugin/-/mini-html-webpack-plugin-1.0.0.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_1.0.0_1558076156487_0.5820087291174734"},"_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":1558076156630,"_cnpm_publish_time":1558076156630,"dist-tags":{"latest":"3.1.3"}}