{"id":13678053,"url":"https://github.com/soub4i/web-merge","last_synced_at":"2026-01-23T07:43:39.993Z","repository":{"id":57161630,"uuid":"295194372","full_name":"soub4i/web-merge","owner":"soub4i","description":"Declarative client-side web fragment merger using web component APIs","archived":false,"fork":false,"pushed_at":"2022-02-03T02:13:39.000Z","size":1209,"stargazers_count":25,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-01T02:56:23.539Z","etag":null,"topics":["fragments","microfrontend","web-components"],"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/soub4i.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-09-13T16:44:18.000Z","updated_at":"2023-03-02T14:20:45.000Z","dependencies_parsed_at":"2022-09-09T10:22:07.468Z","dependency_job_id":null,"html_url":"https://github.com/soub4i/web-merge","commit_stats":null,"previous_names":["abderrahimsoubaielidrissi/web-merge"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/soub4i/web-merge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soub4i%2Fweb-merge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soub4i%2Fweb-merge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soub4i%2Fweb-merge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soub4i%2Fweb-merge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soub4i","download_url":"https://codeload.github.com/soub4i/web-merge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soub4i%2Fweb-merge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28664831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T14:01:31.714Z","status":"ssl_error","status_checked_at":"2026-01-22T13:59:23.143Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["fragments","microfrontend","web-components"],"created_at":"2024-08-02T13:00:49.718Z","updated_at":"2026-01-23T07:43:39.971Z","avatar_url":"https://github.com/soub4i.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Web Merge\n\n[![Build Status](https://travis-ci.org/AbderrahimSoubaiElidrissi/web-merge.svg?branch=master)](https://travis-ci.org/AbderrahimSoubaiElidrissi/web-merge)\n\nDeclarative client-side web fragments (apps/files) merger using web component APIs\n\n\n\n## NOTE\n\u003e EXPERIMENTAL DO NOT USE IN PRODUCTION\n\n\n\n\n## Installation\n\n## 1. via npm  (Recommended)\n\n```shell\n$ npm install @soubai/web-merge\n\n# or\n\n$ yarn add @soubai/web-merge\n```\n\nThen import it in your script\n\n\n```js\nimport '@soubai/web-merge'\n```\n\n## 2. via unpkg\n\n```html\n\u003cscript type=\"module\" src=\"//unpkg.com/@soubai/web-merge\"\u003e\u003c/script\u003e\n```\n\n\n\n## Usage\n\nuse `\u003cweb-merge\u003e` custom element to load you fragment into web application\n\n```html\n\u003cweb-merge content=\"./fragments/fragment-1.html\"\u003e\u003c/web-merge\u003e\n\n\u003cweb-merge content=\"./fragments/fragment-2.html\"\u003e\u003c/web-merge\u003e\n```\n\n### Attributes \n\n**content**: define the source of you fragments (files,urls ...)\n```html\n\n\u003cweb-merge content=\"./fragments/fragment-1.html\"\u003e\u003c/web-merge\u003e\n\n\n\u003cweb-merge content=\"http://localhost:3000\"\u003e\u003c/web-merge\u003e\n\n```\n\n\n**lazy**: allow lazy loading for a fragment \n\n```html\n\u003cweb-merge lazy content=\"./fragments/fragment-1.html\"\u003e\u003c/web-merge\u003e\n\n```\n\n**route**: define the route of the component that will be loaded when the this route is fired.\n\n```html\n\u003cweb-merge route='/cart' content=\"http://127.0.0.1:3000\"\u003e\u003c/web-merge\u003e\n```\n\n## Features\n\n### 1.State management\n\nWeb-merge includes a build-in simple state management system based on event (not Event bus).\n\nThe fragment `parent` expose a `state` class that can help you to mutate and get new store \n\n```js\n        \n// fragment-3.html\n\nconst { state } = parent;\n\n//initial state \n\nstate.init({ count: 0 })\n\n//event name \n\nconst COUNT_CHANGE = \"countChange\";\n\n//Apply side effects \nstate.on(COUNT_CHANGE, ({ count }) =\u003e {\n    document.querySelector(\"span.value\").textContent = count;\n});\n\n//mutations \n\ndocument.getElementById(\"inc\").addEventListener(\"click\", function () {\n    state.dispatch(COUNT_CHANGE, ({ count }) =\u003e ({ count: count + 1 }));\n        });\n\ndocument.getElementById(\"dec\").addEventListener(\"click\", function () {\n    state.dispatch(COUNT_CHANGE, ({ count }) =\u003e ({ count: count - 1 }));\n});\n\n```\n\n\n![](https://www.linkpicture.com/q/preview-2.gif)\n\n### 2.Routing\n\nWeb-merge includes a build-in pushState router that will helps you to load fragments/apps based on route.\n\nThe fragment `parent` expose a `router` class that can help you to perform routing action to load fragments/apps\n\nYou need to warper your fragments/apps with  `web-merge-router` component and define `base` attribute as root route of your routing system; Than add `route` attribute to your fragments/apps to define the route that will load the fragment\n\n```html\n\u003c!-- index.html --\u003e\n\n\u003cweb-merge-router base=\"/examples\"\u003e\n\u003cweb-merge route=\"/\" content=\"./fragments/fragment-6.html\"\u003e\u003c/web-merge\u003e\n\u003cweb-merge route=\"/about\" content=\"./fragments/fragment-5.html\"\u003e\u003c/web-merge\u003e\n\u003c/web-merge-router\u003e\n\n\n```\n\n```js\n        \n// fragment-5.html\n\nconst { router } = parent;\n\n```\n\n```html\n        \n\u003c!-- fragment-5.html --\u003e\n\n\u003cul\u003e\n\u003cli\u003e\n\u003ca onclick=\"router.onNavigate('/')\" href=\"#\"\u003eHome\u003c/a\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003ca onclick=\"router.onNavigate('/about')\" href=\"#\"\u003eAbout\u003c/a\u003e\n\n\u003c/li\u003e\n\u003c/ul\u003e\n\n```\n\n\n![](https://www.linkpicture.com/q/preview-3.gif)\n\n\n\n## Development \n\nAfter cloning package on your local machine :\n\n```shell\n$ npm install\n\n# start dev server to test examples locally\n\n$ yarn dev\n\n# Build \n\n$ yarn build\n```\n\n## Changelog \n\n\n[See the changelog here](CHANGELOG.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoub4i%2Fweb-merge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoub4i%2Fweb-merge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoub4i%2Fweb-merge/lists"}