{"id":23239437,"url":"https://github.com/r32/html-inline","last_synced_at":"2025-04-05T22:13:44.741Z","repository":{"id":78669578,"uuid":"134047521","full_name":"R32/html-inline","owner":"R32","description":"minify HTML and inline JS and CSS","archived":false,"fork":false,"pushed_at":"2023-07-07T12:06:59.000Z","size":759,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T03:17:18.802Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haxe","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/R32.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-19T09:17:46.000Z","updated_at":"2021-12-20T04:48:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e5da855-698d-4bb4-938f-ee92d5a036b7","html_url":"https://github.com/R32/html-inline","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/R32%2Fhtml-inline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R32%2Fhtml-inline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R32%2Fhtml-inline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R32%2Fhtml-inline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/R32","download_url":"https://codeload.github.com/R32/html-inline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406110,"owners_count":20933806,"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-12-19T04:28:14.432Z","updated_at":"2025-04-05T22:13:44.715Z","avatar_url":"https://github.com/R32.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"html-inline\r\n-------\r\n\r\n* minify HTML: It will remove all extra spaces and comments.\r\n\r\n* minify scripts and css by [java YUI Compressor](https://github.com/yui/yuicompressor)\r\n\r\n\r\n### Installation\r\n\r\nAvailable on haxelib, simply run the following command:\r\n\r\n```bash\r\nhaxelib install html-inline\r\n```\r\n\r\n### Usage\r\n\r\n```bash\r\nInline all script/css to HTML. version : 0.5.0\r\n  Usage: haxelib run html-inline [Options] \u003cfile\u003e\r\n Options:\r\n   -h, --help          : help informations\r\n   -s, --only-spaces   : removes extra spaces only\r\n   -m, --no-merge      : don't merge style/script tags\r\n   -k, --hook \u003cscript\u003e : an easy way to modify the parsed XML\r\n```\r\n\r\nsample:\r\n\r\n```bash\r\n# The default will be output to stdout\r\nhaxelib run html-inline index.html\r\n\r\n# or\r\nhaxelib run html-inline index.html \u003e out.html\r\n```\r\n\r\nhtml file:\r\n\r\n```html\r\n\u003c!-- DEFAULT: all scripts and styles will be mifinied by yuicompressor and inline to HTML --\u003e\r\n\u003clink href=\"style.css\" /\u003e\r\n\r\n\u003c!-- hi-skip: Do nothing --\u003e\r\n\u003clink href=\"style.css\" hi-skip /\u003e\r\n\r\n\u003c!-- hi-mini: Minify(style.css) =\u003e (style.min.css) and update href --\u003e\r\n\u003clink href=\"style.css\" hi-mini /\u003e\r\n\r\n\u003c!-- hi-inline: Explicitly inline js/css even --only-spaces is specified --\u003e\r\n\u003clink href=\"style.css\" hi-inline /\u003e\r\n```\r\n\r\nexample:\r\n\r\n```html\r\n\u003chtml\u003e\r\n  \u003chead\u003e\r\n    \u003clink rel=\"stylesheet\" href=\"normal.css\" /\u003e\r\n    \u003clink rel=\"stylesheet\" href=\"base.css\" /\u003e\r\n    \u003ctitle\u003etest\u003c/title\u003e\r\n  \u003c/head\u003e\r\n  \u003cbody\u003e\r\n    \u003cscript src=\"hi.js\"\u003e\u003c/script\u003e\r\n  \u003c/body\u003e\r\n\u003c/html\u003e\r\n```\r\n\r\n`haxelib run html-inline example.html` :\r\n\r\n```html\r\n\u003chtml\u003e\u003chead\u003e\u003cstyle rel=\"stylesheet\" type=\"text/css\"\u003ebutton{color:blue}\u003c/style\u003e\u003cstyle rel=\"stylesheet\" type=\"text/css\"\u003ehtml,body{margin:0;padding:0}\u003c/style\u003e\u003ctitle\u003etest\u003c/title\u003e\u003c/head\u003e\u003cbody\u003e\u003cscript type=\"text/javascript\"\u003econsole.log(\"hello world!\");\u003c/script\u003e\u003c/body\u003e\u003c/html\u003e\r\n```\r\n\r\nnew `-h, --hook \u003cscript\u003e`, Hooked script uses normal haxe syntax(only works in eval/interp platform).\r\nThe script will be automatically parsed into a `function` by the macro\r\n\r\n```bash\r\nhaxelib run html-inline index.html --hook modify.hx\r\n```\r\n\r\nmodify.hx\r\n\r\n```haxe\r\ndoc.one(\"h2\").setAttribute(\"hello\", \"world\");\r\n\r\n// add \"nonce\" for all script tag\r\nvar scripts = doc.all(\"script\");\r\nfor (sn in scripts) {\r\n\tsn.setAttribute(\"nonce\", \"randskey\");\r\n}\r\n\r\n// add \u003cbase\u003e\r\nvar base = Xml.createElement(\"base\", 0); // csss.xml.Xml\r\nbase.setAttribute(\"target\", \"_self\");\r\ndoc.one(\"head\").insertChild(base, 0);\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr32%2Fhtml-inline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr32%2Fhtml-inline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr32%2Fhtml-inline/lists"}