{"id":21352060,"url":"https://github.com/static-dev/spike-preact-ssr","last_synced_at":"2025-07-12T20:32:01.755Z","repository":{"id":57367493,"uuid":"89615000","full_name":"static-dev/spike-preact-ssr","owner":"static-dev","description":"Render preact components to static html through webpack","archived":false,"fork":false,"pushed_at":"2017-04-27T16:09:55.000Z","size":65,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-12T23:26:12.159Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/static-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-27T15:53:59.000Z","updated_at":"2018-06-11T22:41:39.000Z","dependencies_parsed_at":"2022-08-23T19:30:35.145Z","dependency_job_id":null,"html_url":"https://github.com/static-dev/spike-preact-ssr","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/static-dev%2Fspike-preact-ssr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/static-dev%2Fspike-preact-ssr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/static-dev%2Fspike-preact-ssr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/static-dev%2Fspike-preact-ssr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/static-dev","download_url":"https://codeload.github.com/static-dev/spike-preact-ssr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225708259,"owners_count":17511634,"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-11-22T03:12:26.021Z","updated_at":"2024-11-22T03:12:26.616Z","avatar_url":"https://github.com/static-dev.png","language":"JavaScript","readme":"# Spike Preact SSR\n\n[![npm](https://img.shields.io/npm/v/spike-preact-ssr.svg?style=flat-square)](https://npmjs.com/package/spike-preact-ssr)\n[![tests](https://img.shields.io/travis/static-dev/spike-preact-ssr.svg?style=flat-square)](https://travis-ci.org/static-dev/spike-preact-ssr?branch=master)\n[![dependencies](https://img.shields.io/david/static-dev/spike-preact-ssr.svg?style=flat-square)](https://david-dm.org/static-dev/spike-preact-ssr)\n[![coverage](https://img.shields.io/codecov/c/github/static-dev/spike-preact-ssr.svg?style=flat-square)](https://codecov.io/gh/static-dev/spike-preact-ssr)\n\nEasily render [preact](https://github.com/developit/preact) components to HTML\n\n\u003e **Note:** This project is in early development, and versioning is a little different. [Read this](http://markup.im/#q4_cRZ1Q) for more details.\n\n### Installation\n\n`yarn add spike-preact-ssr`\n\n### Usage\n\nLet's say you have some preact components in a folder under `assets/js/pages`, like this:\n\n```js\nexport default ({ foo }) =\u003e {\n  return (\u003cp\u003eHello there! Foo is {foo}\u003c/p\u003e)\n}\n```\n\n...and you want to prerender these as HTML. You'd just add the plugin to spike, and tell it where your component(s) are, and how to map them to an output path as such:\n\n```js\nconst path = require('path')\nconst PreactSSR = require('spike-preact-ssr')\n\nmodule.exports = {\n  // ...\n  plugins: [\n    new PreactSSR({\n      pages: 'assets/js/pages/*.js', // globstar syntax optional\n      props: { foo: 'bar' }, // props to pass to root component\n      output: (relativePath) =\u003e path.basename(relativePath).replace(/\\.js$/, '.html') // by default it will map to its current location and just replace .js with .html\n    })\n  ]\n  // ...\n}\n```\n\nThat's it! Run spike, and you'll see some nice pretty html rendered out as you wanted. If you have interactive components, you can then run them from JS as well and it will work just like normal server side rendering.\n\n### License \u0026 Contributing\n\n- Details on the license [can be found here](LICENSE.md)\n- Details on running tests and contributing [can be found here](contributing.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatic-dev%2Fspike-preact-ssr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatic-dev%2Fspike-preact-ssr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatic-dev%2Fspike-preact-ssr/lists"}