{"id":30300306,"url":"https://github.com/bfncs/metalsmith-servercomponents","last_synced_at":"2025-08-17T04:32:54.882Z","repository":{"id":57295691,"uuid":"67798909","full_name":"bfncs/metalsmith-servercomponents","owner":"bfncs","description":"A Metalsmith plugin for lightweight server-side custom HTML elements. ","archived":false,"fork":false,"pushed_at":"2016-09-09T16:54:24.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T10:49:50.119Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/bfncs.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}},"created_at":"2016-09-09T12:55:59.000Z","updated_at":"2016-09-09T16:04:50.000Z","dependencies_parsed_at":"2022-08-29T09:50:41.921Z","dependency_job_id":null,"html_url":"https://github.com/bfncs/metalsmith-servercomponents","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bfncs/metalsmith-servercomponents","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfncs%2Fmetalsmith-servercomponents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfncs%2Fmetalsmith-servercomponents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfncs%2Fmetalsmith-servercomponents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfncs%2Fmetalsmith-servercomponents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bfncs","download_url":"https://codeload.github.com/bfncs/metalsmith-servercomponents/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfncs%2Fmetalsmith-servercomponents/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270807431,"owners_count":24649342,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-08-17T04:32:27.394Z","updated_at":"2025-08-17T04:32:54.828Z","avatar_url":"https://github.com/bfncs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Metalsmith ServerComponents\n\nA [Metalsmith](https://github.com/metalsmith/metalsmith) plugin for lightweight server-side custom HTML elements.\n\nThis plugins enables the usage of custom HTML elements – broadly following the [spec](http://w3c.github.io/webcomponents/spec/custom/) – in Metalsmith projects.\n\n## Installation\n\nInstall in your metalsmith project using:\n\n```\nnpm install metalsmith-servercomponents\n````\n\n## Usage\n\n\nTo use it, add a custom components defined with the [ServerComponents-API](https://github.com/pimterry/server-components#api-documentation) to your projects `components` folder.\n\n```\n// File: components/hello-world.js\nmodule.exports = function(components) {\n\tvar StaticElement = components.newElement();\n\tStaticElement.createdCallback = function () {\n\t\tthis.innerHTML = \"Hello world\";\n\t};\n\tcomponents.registerElement(\"hello-world\", { prototype: StaticElement });\n};\n```\n\nIn your Metalsmith build script add the ServerComponents plugin.\n\n```\n// File: build.js\nvar Metalsmith = require('metalsmith');\nvar components = require('metalsmith-servercomponents');\n\nMetalsmith(__dirname)\n  .source('./src')\n  .destination('./build')\n  .clean(false)\n  .use(components())\n  .build(function(err, files) {\n    if (err) { throw err; }\n  });\n```\n\nEvery occurence of the custom components you defined in your source files will be replaced by an instantiated entity.\n\n```\n\u003c!-- File src/index.html --\u003e\n\u003c!doctype html\u003e\n\u003chtml lang=en\u003e\n\u003chead\u003e\n\t\u003cmeta charset=utf-8\u003e\n\t\u003ctitle\u003eFoobar\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\t\u003chello-world /\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n…is converted to…\n\n```\n\u003c!-- File src/index.html --\u003e\n\u003c!doctype html\u003e\n\u003chtml lang=en\u003e\n\u003chead\u003e\n\t\u003cmeta charset=utf-8\u003e\n\t\u003ctitle\u003eFoobar\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\t\u003chello-world\u003eHello world\u003c/hello-world\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nYou can use the whole custom component API to define components, refer to the [example components](https://github.com/pimterry/server-components/blob/master/component-examples.md) to see what is possible.\n\n## To Do\n\n* Handle styles per component: from unnamespaced, plain (S)CSS to automatically namespaced BEM selectors\n* Handle clientside JS per component\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfncs%2Fmetalsmith-servercomponents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbfncs%2Fmetalsmith-servercomponents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfncs%2Fmetalsmith-servercomponents/lists"}