{"id":16198691,"url":"https://github.com/ali322/inject-html-webpack-plugin","last_synced_at":"2025-03-19T05:30:37.856Z","repository":{"id":49548558,"uuid":"77612542","full_name":"ali322/inject-html-webpack-plugin","owner":"ali322","description":"inject script label and style links into your html","archived":false,"fork":false,"pushed_at":"2021-06-08T07:06:52.000Z","size":134,"stargazers_count":8,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T04:03:41.530Z","etag":null,"topics":["webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ali322.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-29T13:03:14.000Z","updated_at":"2022-06-08T14:48:39.000Z","dependencies_parsed_at":"2022-09-01T16:04:19.620Z","dependency_job_id":null,"html_url":"https://github.com/ali322/inject-html-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali322%2Finject-html-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali322%2Finject-html-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali322%2Finject-html-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali322%2Finject-html-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ali322","download_url":"https://codeload.github.com/ali322/inject-html-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244364584,"owners_count":20441458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["webpack","webpack-plugin"],"created_at":"2024-10-10T09:14:36.656Z","updated_at":"2025-03-19T05:30:37.598Z","avatar_url":"https://github.com/ali322.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"inject-html-webpack-plugin \n[![Build Status](https://travis-ci.org/ali322/inject-html-webpack-plugin.svg?branch=master)](https://travis-ci.org/ali322/inject-html-webpack-plugin)\n===\n[![NPM](https://nodei.co/npm/inject-html-webpack-plugin.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/inject-html-webpack-plugin/)\n\ninspired by [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin),simple and efficient Webpack plugin that inject script label and style links into your html\n\nInstall\n===\n\n```javascript\nnpm install inject-html-webpack-plugin --save--dev\n```\n\nUsage\n===\n\nadd plugin in your webpack.config.js\n\n```javascript\nvar InjectHtmlPlugin = require('inject-html-webpack-plugin')\n\nmodule.exports = {\n    entry:{\n        index:\"./index.js\"\n    },\n    module:{\n        loaders:[\n            ...\n        ]\n    },\n    output:{\n        path:'./dist',\n        filename:'[name].min.js'\n    },\n    plugins:[\n        new InjectHtmlPlugin({\n            filename:'./index.html',\n            chunks:['index'],\n            transducer:\"http://cdn.example.com\",\n            custom:[{\n                start:'\u003c!-- start:bundle-time --\u003e',\n                end:'\u003c!-- end:bundle-time --\u003e',\n                content:Date.now()\n            }]\n        })\n    ]\n}\n```\n\nthen add below placeholders into html file\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"UTF-8\"\u003e\n  \u003ctitle\u003eDocument\u003c/title\u003e\n  \u003c!-- start:css --\u003e\n  \u003c!-- end:css --\u003e\n  \u003c!-- start:bundle-time --\u003e\n  \u003c!-- end:bundle-time --\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003c!-- start:js --\u003e\n  \u003c!-- end:js --\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nPlugin Options\n===\n\n- **transducer**: apply transducer to injected file's url,accept prepended string or function that receive file path as argument and return url string as result\n- **filename**: html file path which injected \n- **chunks**: injected array of chunks\n- **jsLabelTemplate**: use function to generate js Label\n- **cssLabelTemplate**: use function to generate css Label\n- **startJS**: start indentifier where to inject script labels,(eg: `\u003c!-- start:js --\u003e`)\n- **endJS**: end indentifier where to inject script labels,(eg: `\u003c!-- end:js --\u003e`)\n- **startCSS**: start indentifier where to inject style links,(eg: `\u003c!-- start:css --\u003e`)\n- **endCSS**: end indentifier where to inject style links,(eg: `\u003c!-- end:css --\u003e`)\n- **custom**: array of custom inject,like bundle time,accept objects contains below key/values,\n    + start: inject start identifier\n    + end: inject end identifier\n    + content: injected content\n\n## License\n\n[MIT License](http://en.wikipedia.org/wiki/MIT_License)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fali322%2Finject-html-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fali322%2Finject-html-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fali322%2Finject-html-webpack-plugin/lists"}