{"id":19768353,"url":"https://github.com/roxiness/spank","last_synced_at":"2025-04-30T16:34:13.182Z","repository":{"id":49808555,"uuid":"297394411","full_name":"roxiness/spank","owner":"roxiness","description":"Slap the pages out of a SPA","archived":false,"fork":false,"pushed_at":"2023-09-21T07:22:33.000Z","size":950,"stargazers_count":51,"open_issues_count":4,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-24T23:48:38.206Z","etag":null,"topics":["export","html","spa","ssr","static","static-export"],"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/roxiness.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-21T16:15:33.000Z","updated_at":"2024-06-19T23:33:47.780Z","dependencies_parsed_at":"2024-06-19T23:33:33.128Z","dependency_job_id":"e8a50470-dcd9-4ac1-8f29-a8672aa91562","html_url":"https://github.com/roxiness/spank","commit_stats":{"total_commits":120,"total_committers":4,"mean_commits":30.0,"dds":"0.10833333333333328","last_synced_commit":"5feefac85f7754c655c9109ffdce4df58426699b"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Fspank","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Fspank/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Fspank/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Fspank/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roxiness","download_url":"https://codeload.github.com/roxiness/spank/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251742833,"owners_count":21636518,"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":["export","html","spa","ssr","static","static-export"],"created_at":"2024-11-12T04:37:41.087Z","updated_at":"2025-04-30T16:34:13.135Z","avatar_url":"https://github.com/roxiness.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"spank.png\" alt=\"spank\" width=\"400\" /\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n## Static Site Generator (SSG) \n#### Exports HTML pages from your SPA\n\n### Usage\n\n```javascript\n//spank.config.js\nmodule.exports = {\n  sitemap: 'path/to/a-list-of-urls.json',\n  template: 'dist/__index.html',\n  script: 'dist/main.js',\n  outputDir: 'dist'\n}\n```\n\nopen your terminal and type\n```\nnpx spank\n```\n\n###### Note\nspank can also be used without a config. Use `npx spank --help` for parameters.\n\n---\n\n### Config options\n\n| prop |default| description |\n|------|-|-------------|\n|sitemap|| array of paths. Eg. `['/', '/about', '/contact']`. Can also be a path to a .js file exporting an array of paths. Eg. `./sitemap.js`|\n|template|`dist/__app.html`| path to the HTML template to render the SPA in. Often `static/index.html`|\n|script|`dist/build/bundle.js`| Path to the app script. Often `dist/build/bundle.js` or `dist/build/main.js`|\n|outputDir|`dist`| Folder to save HTML files to.|\n|forceIndex|`false`| Write `/about` to `about/index.html` instead of `about.html`|\n|inlineDynamicImports|`false`| Required if app uses dynamic imports|\n|concurrently|`3`| Max simultaneous running jobs |\n|eventName|| If specified, HTMLs aren't saved till the page has emitted the event.|\n|host|`http://jsdom.ssr`|Simulated host  |\n|blacklist|[]|List of paths to be ignored. Regular expressions are supported when using spank.config.js|\n|depth|2|How far to crawl any path in the sitemap|\n|ssrOptions|{}|Options to be passed to [tossr](https://github.com/roxiness/tossr#config)|\n|transform|(html, url) =\u003e html|Callback for transforming HTML|\n---\n\n### How does it work?\n\nFor each path in the sitemap, Spank creates a corresponding SPA in a simulated browser. Spank will crawl pages in the sitemap as far as `depth` is set. The HTML for each page is then saved to the output folder.\n\n\n---\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"spank.gif\" alt=\"routify\" /\u003e\u003cbr\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxiness%2Fspank","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froxiness%2Fspank","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxiness%2Fspank/lists"}