{"id":22814187,"url":"https://github.com/smackjax/html-webpack-inject-string-plugin","last_synced_at":"2026-04-29T22:39:48.512Z","repository":{"id":47642067,"uuid":"223049128","full_name":"smackjax/html-webpack-inject-string-plugin","owner":"smackjax","description":"A simple Webpack plugin that injects custom strings into the html-webpack-plugin output","archived":false,"fork":false,"pushed_at":"2022-09-03T14:56:06.000Z","size":468,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T21:31:37.876Z","etag":null,"topics":["customization","html-webpack-plugin","npm","simple","webpack"],"latest_commit_sha":null,"homepage":"","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/smackjax.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":"2019-11-20T23:48:54.000Z","updated_at":"2023-06-29T02:22:46.000Z","dependencies_parsed_at":"2022-09-26T19:42:41.437Z","dependency_job_id":null,"html_url":"https://github.com/smackjax/html-webpack-inject-string-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/smackjax/html-webpack-inject-string-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smackjax%2Fhtml-webpack-inject-string-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smackjax%2Fhtml-webpack-inject-string-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smackjax%2Fhtml-webpack-inject-string-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smackjax%2Fhtml-webpack-inject-string-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smackjax","download_url":"https://codeload.github.com/smackjax/html-webpack-inject-string-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smackjax%2Fhtml-webpack-inject-string-plugin/sbom","scorecard":{"id":832260,"data":{"date":"2025-08-11","repo":{"name":"github.com/smackjax/html-webpack-inject-string-plugin","commit":"455b34979263e3ca17ea94963185594bc5a1131a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/13 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 14 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T18:03:36.468Z","repository_id":47642067,"created_at":"2025-08-23T18:03:36.468Z","updated_at":"2025-08-23T18:03:36.468Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32447292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["customization","html-webpack-plugin","npm","simple","webpack"],"created_at":"2024-12-12T13:07:31.511Z","updated_at":"2026-04-29T22:39:48.490Z","avatar_url":"https://github.com/smackjax.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTML WEBPACK INJECT STRING PLUGIN\n## What's this?\nA dead simple plugin that searches each file output by html-webpack-plugin for a custom string(like a '\\\u003c/body\\\u003e' tag) and prepends, replaces, or appends a custom string by injecting it, then returning the completed template.\n\n## Install\n`npm i -D html-webpack-inject-string-plugin html-webpack-plugin`\n\n## Config default options \n```javascript\n\n{\n    // String to search for\n    search: \"\",\n    // String to inject\n    inject: \"\",\n    \n    // (optional)Injects before found string\n    prepend: true\n    // (optional)Replaces found string with injection\n    replace: false\n    // (optional)Injects after found string\n    append: false\n    \n    // (optional)Adds 'r\\n\\' before or after injection string\n    newline: { before: true, after: true }\n    // (optional)Enables console.log messages\n    dev: false\n}\n```\n\n## Usage (simple)\n``` javascript\nconst htmlWebpackInjectStringPlugin = require('html-webpack-inject-string-plugin');\n{   // ...webpack.config\n    plugins: [\n        // ...htmlWebpackPlugin({}),\n         \n        new htmlWebpackInjectStringPlugin({\n            // String to search for\n            search: \"\u003c/body\u003e\",\n            // String to inject\n            inject: \"\u003cscript\u003ealert('injected')\u003c/script\u003e\"\n            // Defaults to prepending injection before search string\n        }),\n    ]\n}\n```\n\n## Usage (complex)\n``` javascript\nconst htmlWebpackInjectStringPlugin = require('html-webpack-inject-string-plugin');\n{   // ...webpack.config\n    plugins: [\n        // ...htmlWebpackPlugin({}),\n        \n        new htmlWebpackInjectStringPlugin({\n            // String to search for\n            search: \"\u003cdiv id='replace-me'\u003e\u003c/div\u003e\",\n            // String to inject\n            inject: \"\u003cscript\u003ealert('injected')\u003c/script\u003e\",\n            \n            // NOTE: All three of these can be used at the same time\n            // which will inject the same string 3 times in a row\n            prepend: true,\n            replace: true,\n            append: true,\n            \n            // Removes '\\r\\n' before and after the injection\n            newline: false\n            \n            // Turns on console log messages if you want to see what it's doing\n            dev: true\n        }),\n    ]\n}\n```\n\n## Be aware\n* Backslashes may need to be escaped twice(three slashes total), because it's run through a compiler first. \n\n## Wait, isn't this a little dangerous?\nYep! \n\n## So why would I use it?\nBecause sometimes it's just incredibly helpful. \n\nFor instance I needed to inject a browser-sync script into each html-webpack file that contained a closing body tag.\nI didn't want the boilerplate of adding it individually and conditionally(just in dev mode) to each page.\n\nSo I made this plugin to add it automatically and only where and when it was needed. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmackjax%2Fhtml-webpack-inject-string-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmackjax%2Fhtml-webpack-inject-string-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmackjax%2Fhtml-webpack-inject-string-plugin/lists"}