{"id":17241264,"url":"https://github.com/sinoon/html-webpack-auto-inject-plugin","last_synced_at":"2025-03-26T03:13:45.281Z","repository":{"id":57267708,"uuid":"118448545","full_name":"sinoon/html-webpack-auto-inject-plugin","owner":"sinoon","description":"html-webpack-auto-inject-plugin，auto inject javascript file to html","archived":false,"fork":false,"pushed_at":"2018-02-06T07:41:57.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-30T01:36:34.433Z","etag":null,"topics":["html-webpack-plugin","webpack","webpack-plugin"],"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/sinoon.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}},"created_at":"2018-01-22T11:30:56.000Z","updated_at":"2018-01-23T04:42:28.000Z","dependencies_parsed_at":"2022-09-02T05:41:01.397Z","dependency_job_id":null,"html_url":"https://github.com/sinoon/html-webpack-auto-inject-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/sinoon%2Fhtml-webpack-auto-inject-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinoon%2Fhtml-webpack-auto-inject-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinoon%2Fhtml-webpack-auto-inject-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinoon%2Fhtml-webpack-auto-inject-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinoon","download_url":"https://codeload.github.com/sinoon/html-webpack-auto-inject-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245579675,"owners_count":20638679,"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":["html-webpack-plugin","webpack","webpack-plugin"],"created_at":"2024-10-15T06:08:32.253Z","updated_at":"2025-03-26T03:13:45.253Z","avatar_url":"https://github.com/sinoon.png","language":"JavaScript","readme":"# Auto Inject extension for the HTML Webpack Plugin\n\n![travis](https://travis-ci.org/sinoon/html-webpack-auto-inject-plugin.svg?branch=master)\n[![npm version](https://badge.fury.io/js/html-webpack-auto-inject-plugin.svg)](https://badge.fury.io/js/html-webpack-auto-inject-plugin)\n[![codecov](https://codecov.io/gh/sinoon/html-webpack-auto-inject-plugin/branch/master/graph/badge.svg)](https://codecov.io/gh/sinoon/html-webpack-auto-inject-plugin)\n![dependance](https://david-dm.org/sinoon/html-webpack-auto-inject-plugin.svg)\n\nhtml-webpack-auto-inject-plugin，auto inject js file to html\n\n**Only Support Node 8**.You need node LTS version 8 or higher version.\n\n## Why you need\nPersonally, when I need to require/import a js source injecting to html file.ie:`flexible.js`,`some log js`, I have to modify html template file or require/import file that I won't actually exec by code manually. Therefore, I explored a solution to share for such issue.\n\n## Feature\nNow Support:\n\n- Auto inject js file\n- Compress js file\n\nWill Support\n\n- Auto inject css file\n- What you aim to by create issue to me\n\n## How to use\nThis plugin require `html-webpack-plugin`,because listen the event by emit `html-webpack-plugin`:`html-webpack-plugin-before-html-processing`.\n\n## Installation\nYou must be running webpack on node 8 or higher\n\nInstall the plugin with npm:\n\n```bash\n$ npm install --save-dev html-webpack-auto-inject-plugin\n```\n\n## Basic Usage\nRequire the plugin in your webpack config:\n\n```javascript\nconst HtmlWebpackAutoInjectPlugin = require('html-webpack-auto-inject-plugin');\n```\n\nFor now,just support javascript file import,and css file import in 1.0 version will supported.\n\nAll javascript file import config are set in `script`\n\nAdd the plugin to your webpack config as follows:\n\n### options\n\n#### script [Array]\nAccept `string` for file path and `Object` for custom config.Above are explain of options:\n\n| Key | Type | Default | Accept | Require | Mean |\n| --- | --- | --- | --- | --- | --- |\n| path | String | undefined | Any String | True | The path of your want auto inject to html |\n| position | String | 'head' | ‘head’,’body' | False | The position your want to placed code. `head` for inject to head.`body` for inject to end of body. |\n| compress | Boolean | false | true,false | False | Compress or not.`uglify-js`. |\n\n```javascript\nplugins: [\n  new HtmlWebpackPlugin(),\n  new HtmlWebpackAutoInjectPlugin({\n    script: [\n        // relative path\n        './path/to/js',\n        // recommend in this way by use node auto resolve the path of you need inject\n        require.resolve('amfe-flexible'),\n\n        // absolute path\n        '/User/sinoon/code/path/to/js',\n\n        // custom config\n        {\n            path: './path/to/js',\n            compress: true,\n            position: 'body'\n        }\n    ]\n  })\n]\n```\n\n## TODO\n- [ ] Support Css.\n- [ ] Support Ignore.Match by regexp.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinoon%2Fhtml-webpack-auto-inject-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinoon%2Fhtml-webpack-auto-inject-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinoon%2Fhtml-webpack-auto-inject-plugin/lists"}