{"_id":"@ayatkyo/vite-plugin-html-import","_rev":"1-11cd819ba55e9b68a9ad9c61cc4023b6","name":"@ayatkyo/vite-plugin-html-import","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@ayatkyo/vite-plugin-html-import","version":"0.1.0","description":"Vite plugin for import .html as string","type":"module","main":"index.js","author":{"name":"Hidayatullah"},"license":"MIT","dependencies":{"@minify-html/node":"^0.10.8"},"keywords":["vite","vite-plugin"],"gitHead":"ef0f77ea18bc592077e6e9c0628722f2793c1190","_id":"@ayatkyo/vite-plugin-html-import@0.1.0","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-fHu/xKu2OZ8Ax6JOwm2Gw3V6OKkr8fn6P9tXh0ycqzObofIfGSAKj0vbc4Jh9sqLnAe86IHT9jALUTUmnKkpQw==","shasum":"32698c88d575e694a1ceea76daef55cbf1411224","tarball":"https://registry.npmjs.org/@ayatkyo/vite-plugin-html-import/-/vite-plugin-html-import-0.1.0.tgz","fileCount":3,"unpackedSize":1935,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB+NWjYJN8Te4EX7Mh3uEeyJvyVHJxJ+gx0FxdlTD7xCAiAtoq7UJDIt8R3O819lShaaXvN2iUCBKx0yxdFpAfxGtg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkMWGsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqYzBAAgrmDnYlCgYKlXzCHgieAufgeWrT9OL0AXaXpZ6zrG8U1Rr6c\r\n1QUW14LsmaI0N6f/nCRYUgx0PwpicUOOiu1/Ool3K0nzqOgqjnJf/mf5jQ22\r\nchXK9Diy9j21j3TjdQY2NE7pCwydL/cKevpKTAhsPppnQBNR6Rpj4LcaboRq\r\ni8u6ApkZX8N/qXLGmZPtpSNcW7nkM9bzkOWhG89FDdcSMiyPd6x4jj+guNcT\r\nF1nxtna2+8L8G13B9e6YXGjQYvKifHur7AUK3qNzMkSeZdF7rO6y9TfKoZgD\r\nMyPQ3+16AGcDXTEuc33K4t6qyR5ZxpguOn2d+ZFk4qzxPDJwSAFRWE7OszTo\r\nSL9rKLNYCbur85RdEq0xWsERKbj1a0Hov+HGJI86vgPIQIFf4xt62k3sqHRH\r\nKX47XS3Zd7khhpIq0L+qoI96ZKQz1c829oE9gkX8m08xv4YCP035kXL4TrXp\r\nrTBrHnsXDwS2loQ5Y2j9kiMbdpAlzgD9bQVCD6l+ERwPqY9Q5nD/zhaat409\r\nVD7wXDACb3e4dEfuWOGUnYjPG1EDW/byUukb7jcJZ7SpURFvbPK3YfgIYf2K\r\ns3+K1GAmtf2fvSn1CMNZZEm/3/kj4IWtowoLxG6YSwy16o23A9OBgtGDOSQ4\r\nO+ikyBAIxfMHj8uZwxP95/+Rg9eYZrAYabM=\r\n=0lSo\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"ayatkyo","email":"ayat.kyo@gmail.com"},"directories":{},"maintainers":[{"name":"ayatkyo","email":"ayat.kyo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-html-import_0.1.0_1680957868371_0.4375594138192602"},"_hasShrinkwrap":false},"0.1.2":{"name":"@ayatkyo/vite-plugin-html-import","version":"0.1.2","description":"Vite plugin for importing .html file as string","type":"module","main":"index.js","author":{"name":"Hidayatullah"},"license":"MIT","dependencies":{"@minify-html/node":"^0.10.8"},"keywords":["vite","vite-plugin"],"homepage":"https://github.com/ayatkyo/vite-plugin-html-import","bugs":{"url":"https://github.com/ayatkyo/vite-plugin-html-import/issues"},"repository":{"type":"git","url":"git+https://github.com/ayatkyo/vite-plugin-html-import.git"},"gitHead":"b8366333ba5296b5933140926f167ed68d635bbe","_id":"@ayatkyo/vite-plugin-html-import@0.1.2","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-kVAUpwo+uisVcDBeRJUXRNnKeMC9fNjH1wDTnPTickrwJhHM+S888fo403cDin0q8fvK5o21IBhjoG4ahn7nfg==","shasum":"081d5da8a2ac1db13c083c4172b206cd8fc75308","tarball":"https://registry.npmjs.org/@ayatkyo/vite-plugin-html-import/-/vite-plugin-html-import-0.1.2.tgz","fileCount":3,"unpackedSize":3817,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAQUlHT6MF6gnB0wrJvqQZ3RKCithvbmNq4uyw5jsIX0AiB22GitVatoSuG6E2fT2a1KZKmvzdeHl39EOXH3B4dx7Q=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkMZ79ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrDFA/+PuYgs2bOk54Xx7wo7YTdb/f4NIFiWtInsSz2dpr6NeQ9WVmz\r\nNfzkqMcd0Qa7f3J+0UTpDwHzD6SnoqTM+5wsbYLyM7ocpsAQDo3aj6PvXPlI\r\nlKssLCPaFkaxGI+QB+EEOkcxghAWJDOvxJ5+UqiKVnAqlTqVP/CmpbmDkslg\r\nv2/81Z6X9LbO4R+2GS3yAb9i+9H231oKyMTmYJ1Qj+zVTJmDyJAhOAHL3Xvd\r\n6sN4ggWe9eMR0Blc9oqOsiVpsOVMx5TPHmbg+f+8zzZxUhEgw+viU4p9M1lK\r\nJPjZBcZrYJB63zBgWEF80FA8zNj2EdUvh3OfDlByKA5z/FOa7VO2rNPjAOf3\r\nO6Ff2XWN24DYoq642SEOuW3p5FUsdPuKO+ezK6hjBs8hFqNYUjUCNlOCtvfR\r\nM5j7+MteDJ5ss1U9ofpF+dJhWUeHbh4bKIaAt2Dry5bPk03a7iyR2QYbQYIi\r\nQM1h2ieEUEDGKcD07XgPXhVulgrf2OyUBwtCfUaTdCSIKrXkWED3Ix0j7w1Y\r\n0UIcS/5jhIqxqdqhze4AioF5Ieqx0wrvxRPTtM2hn/MEK6INd7WGZP6JxE8g\r\n3kcRPkJB3ORpt7uSl1a4Ycw+o/PV9BXuvjCAWId4bXy00ZZPkcwU3Itv4iG3\r\n01di5GJ/SlNq43kf28WVR6j9BeN2ujTNgl4=\r\n=vzag\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"ayatkyo","email":"ayat.kyo@gmail.com"},"directories":{},"maintainers":[{"name":"ayatkyo","email":"ayat.kyo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-html-import_0.1.2_1680973564910_0.7535656085128584"},"_hasShrinkwrap":false}},"time":{"created":"2023-04-08T12:44:28.317Z","0.1.0":"2023-04-08T12:44:28.520Z","modified":"2023-04-08T17:06:05.198Z","0.1.2":"2023-04-08T17:06:05.088Z"},"maintainers":[{"name":"ayatkyo","email":"ayat.kyo@gmail.com"}],"description":"Vite plugin for importing .html file as string","keywords":["vite","vite-plugin"],"author":{"name":"Hidayatullah"},"license":"MIT","readme":"# HTML Import - Vite plugin\r\n\r\nVite plugin for import .html as string.\r\n\r\n[![NPM version](https://img.shields.io/npm/v/@ayatkyo/vite-plugin-html-import.svg)](https://www.npmjs.com/package/@ayatkyo/vite-plugin-html-import)\r\n\r\n## 🤔 Why\r\n\r\nActually we can import html file as a string using:\r\n\r\n```js\r\nimport htmlString from './partial.html?raw'\r\n```\r\n\r\nbut when running `vite build` the html string is not minified and we need to add `?raw` to the import syntax.\r\n\r\nSo with this plugin, we just need to import html file as usual without adding `?raw`:\r\n\r\n```js\r\nimport htmlString from './partial.html'\r\n```\r\n\r\nWhen running `vite build` the html string also minified.\r\n\r\nIf needed we also can do another thing to the html string buffer.\r\n\r\n## ⚙️ Installing\r\n\r\n```shell\r\nnpm i @ayatkyo/vite-plugin-html-import\r\n```\r\n\r\n## 📖 Usage\r\n\r\nMake sure the `type` in the project `package.json` is set to `module`.\r\n\r\n```js\r\n{\r\n  // ...\r\n  \"type\": \"module\",\r\n  // ...\r\n}\r\n```\r\n\r\nAdd `htmlImport` into plugins in `vite.config.js`:\r\n\r\n```js\r\nimport htmlImport from '@ayatkyo/vite-plugin-html-import';\r\n\r\nexport default defineConfig({\r\n  // ...\r\n  plugins: [\r\n    // ...\r\n    htmlImport(),\r\n  ],\r\n});\r\n```\r\n\r\nNow we can import html file like this:\r\n\r\n```js\r\nimport template from './path/to/file.html';\r\n\r\ndocument.body.innerHTML = template;\r\n// or\r\nVue.component('some-component', {\r\n  template: template,\r\n  // ...\r\n});\r\n```\r\n\r\n## 🎯 TODO\r\n\r\n- [ ] Add plugin configuration\r\n  - [ ] Allow to disable minify using `minify: false`\r\n  - [ ] Allow to pass configuration into `minify-html` plugin\r\n\r\n## ⭐️ Thanks\r\n\r\n- [Vite](https://vitejs.dev/)\r\n- [minify-html](https://github.com/wilsonzlin/minify-html)\r\n","readmeFilename":"README.md","homepage":"https://github.com/ayatkyo/vite-plugin-html-import","repository":{"type":"git","url":"git+https://github.com/ayatkyo/vite-plugin-html-import.git"},"bugs":{"url":"https://github.com/ayatkyo/vite-plugin-html-import/issues"}}