{"id":15661344,"url":"https://github.com/justinidlerz/html-webpack-prefix-plugin","last_synced_at":"2025-08-20T00:41:25.025Z","repository":{"id":57267801,"uuid":"64109943","full_name":"Justinidlerz/html-webpack-prefix-plugin","owner":"Justinidlerz","description":"Prefix extension for the HTML-Webpack-Plugin for webpack 1.x","archived":false,"fork":false,"pushed_at":"2023-02-28T12:24:27.000Z","size":334,"stargazers_count":17,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T23:20:30.696Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Justinidlerz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-25T06:39:27.000Z","updated_at":"2023-03-04T05:57:56.000Z","dependencies_parsed_at":"2024-06-18T22:58:51.257Z","dependency_job_id":"1a91d23e-a999-482d-9d7a-014abe3ec326","html_url":"https://github.com/Justinidlerz/html-webpack-prefix-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/Justinidlerz%2Fhtml-webpack-prefix-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Justinidlerz%2Fhtml-webpack-prefix-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Justinidlerz%2Fhtml-webpack-prefix-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Justinidlerz%2Fhtml-webpack-prefix-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Justinidlerz","download_url":"https://codeload.github.com/Justinidlerz/html-webpack-prefix-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252591491,"owners_count":21773119,"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":[],"created_at":"2024-10-03T13:27:10.270Z","updated_at":"2025-05-05T23:24:23.338Z","avatar_url":"https://github.com/Justinidlerz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"HTML-Webpack-Prefix-Plugin\n==========================\n\nPrefix extension for the HTML-Webpack-Plugin\n\nEnhances [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin) function by adding the options.\n```javascript\n{\n  prefix: '//example.com/', \n  attrs : { \n    'img:src': false \n  } \n}\n```\n\n\nThis is an extension plugin for the [webpack](http://webpack.github.io) plugin [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin)  \nA plugin that simplifies the creation of HTML files to serve your webpack bundles.\n\nCompatibility\n=============\n\nOnly compatible with Webpack 1.x and 2.x\n\nInstallation\n------------\nYou must be running webpack on node 6.x or higher\n\nInstall the plugin with npm:\n```shell\n$ npm install html-webpack-prefix-plugin --save-dev\n```\n\nBasic Usage\n-----------\nAdd the plugin to your webpack config as follows:\n\n```javascript\nplugins: [\n  new HtmlWebpackPlugin(),\n  new HtmlWebpackPrefixPlugin()\n]  \n```\nThe above configuration will actually do nothing due to the configuration defaults.  \n\n\nAs soon as you now set `prefix` to a path the generated output of the HtmlWebpackPlugin will always append prefix to matched attributes from HTML label. \n```javascript\nplugins: [\n  new HtmlWebpackPlugin({\n    prefix: '//example.com/'\n  }),\n  new HtmlWebpackPrefixPlugin()\n]  \n```\n\nEven if you generate multiple files make sure that you add the HtmlWebpackPrefixPlugin **only once**:\n```javascript\nplugins: [\n  new HtmlWebpackPlugin({\n    prefix: '//example.com/'\n  }),\n  new HtmlWebpackPlugin({\n    prefix: '//example.com/',\n    filename: 'demo.html'\n  }),\n  new HtmlWebpackPlugin({\n    prefix: '//example.com/',\n    filename: 'test.html'\n  }),\n  new HtmlWebpackPrefixPlugin()\n]  \n```\n\nThe html-webpack-prefix-plugin had default prefix attributes options   \n  - img:src\n  - img:srcset\n  - img:data-src\n  - script:src\n  - link:href     \n\nIf you want to remove and add attr you can set attributes options like so:\n\n```javascript\nnew HtmlWebpackPlugin({\n  prefix: '//example.com/',\n  attrs : {\n    'img:src': false, //remove from default option\n    'img:data-url': true // add new attribute to field\n  }\n})\n```\n\nIf you only want to append attribute to default,  \nyou can parse the Array to options like so:\n\n```javascript\nnew HtmlWebpackPlugin({\n  prefix: '//xxx.xxx.com/',\n  attrs : ['img:url']\n})\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinidlerz%2Fhtml-webpack-prefix-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinidlerz%2Fhtml-webpack-prefix-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinidlerz%2Fhtml-webpack-prefix-plugin/lists"}