{"id":22886760,"url":"https://github.com/evolutionjobs/htmlimport2esmodule","last_synced_at":"2025-03-31T19:12:27.461Z","repository":{"id":101027649,"uuid":"155467384","full_name":"EvolutionJobs/HtmlImport2ESModule","owner":"EvolutionJobs","description":"Regex file parser to find and insert HTML imports into JS files","archived":false,"fork":false,"pushed_at":"2018-10-31T21:57:33.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T23:28:53.404Z","etag":null,"topics":["command-line-tool","es-modules","html-imports","polymer2","polymer3"],"latest_commit_sha":null,"homepage":null,"language":"C#","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/EvolutionJobs.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-10-30T22:58:44.000Z","updated_at":"2018-10-31T21:57:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"c3835789-2a0e-4887-9c6e-d28f38da11eb","html_url":"https://github.com/EvolutionJobs/HtmlImport2ESModule","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/EvolutionJobs%2FHtmlImport2ESModule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvolutionJobs%2FHtmlImport2ESModule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvolutionJobs%2FHtmlImport2ESModule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvolutionJobs%2FHtmlImport2ESModule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvolutionJobs","download_url":"https://codeload.github.com/EvolutionJobs/HtmlImport2ESModule/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246523874,"owners_count":20791444,"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":["command-line-tool","es-modules","html-imports","polymer2","polymer3"],"created_at":"2024-12-13T20:27:43.004Z","updated_at":"2025-03-31T19:12:27.425Z","avatar_url":"https://github.com/EvolutionJobs.png","language":"C#","readme":"# HTML Import to ES Module\nRegex file parser to find and insert HTML imports into JS files.\n\nThis checks for JS files with matching HTML (for the code behind pattern) then just looks for HTML files.\n\nThen this:\n\n- Tries to parse any JS from `\u003cscript\u003e` tags in the HTML.\n- Looks for the `static get is()` property Polymer 2 uses to find the `\u003cdom-module\u003e`.\n- Finds the `\u003ctemplate\u003e` in the relevant `\u003cdom-module\u003e`. \n- Extracts any scripts nested inside the template.\n- Extracts any `\u003cstyle\u003e` content into a `const`\n- CSS includes are included as explicit variables - **the files themselves need to be converted manually**.\n- HTML `import` directives are converted to ES Modules.\n- `Polymer.Element` is replaced by `PolymerElement`.\n- HTML template inserted as a literal string in the JS file.\n- JS file writtent to disk.\n- HTML file deleted.\n\n## Caveats\n\nThis is very much utlity code, with most corner cases just crashing. Expect bugs.\n\nDependencies are assumed to be in a library directory, and the name of this directory is used to find/replace dependencies references.\nThis is a very quick and dirty way to do this - if you want to use this in your own application you will either have to use the same pattern or write the relative link checking code yourself.\n\n## Why not use the offical [polymer-modulizer](https://github.com/Polymer/polymer-modulizer)?\n\nBecause it doesn't work. \nSpecifically:\n\n- [polymer-modulizer#428](https://github.com/Polymer/polymer-modulizer/issues/428) It runs out of memory.\n- [polymer-modulizer#429](https://github.com/Polymer/polymer-modulizer/issues/429) It breaks if updating isolated from Git.\n- [polymer-modulizer#438](https://github.com/Polymer/polymer-modulizer/issues/438) It builds `\u003cdiv\u003e` tags with `innerText` rather than creating templates.\n\nThis doesn't aim to do all the complex parsing of JS that the modualizer aspires to - I just want to make the same pattern changes to a few hundred HTML import components.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevolutionjobs%2Fhtmlimport2esmodule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevolutionjobs%2Fhtmlimport2esmodule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevolutionjobs%2Fhtmlimport2esmodule/lists"}