{"id":19090724,"url":"https://github.com/kodedninja/nanocrane","last_synced_at":"2025-11-11T17:31:58.841Z","repository":{"id":57678116,"uuid":"203142297","full_name":"kodedninja/nanocrane","owner":"kodedninja","description":"🏗 Versatile static-site builder for Choo","archived":false,"fork":false,"pushed_at":"2019-08-24T19:03:31.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T04:54:37.196Z","etag":null,"topics":[],"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/kodedninja.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":"2019-08-19T09:33:25.000Z","updated_at":"2023-03-27T01:04:20.000Z","dependencies_parsed_at":"2022-09-13T13:12:58.480Z","dependency_job_id":null,"html_url":"https://github.com/kodedninja/nanocrane","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Fnanocrane","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Fnanocrane/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Fnanocrane/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Fnanocrane/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kodedninja","download_url":"https://codeload.github.com/kodedninja/nanocrane/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240138108,"owners_count":19753865,"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-09T03:08:45.781Z","updated_at":"2025-11-11T17:31:53.814Z","avatar_url":"https://github.com/kodedninja.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nanocrane\n\u003ca href=\"https://nodejs.org/api/documentation.html#documentation_stability_index\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square\" alt=\"Stability\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/nanocrane\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/nanocrane.svg?style=flat-square\" alt=\"NPM version\"/\u003e\n\u003c/a\u003e\n\nVersatile static-site builder library for [Choo](https://github.com/choojs/choo).\n\nMerges an exported Choo application + a state object with content + an HTML string and outputs a set of static HTML files.\n\n## Installation\n```\nnpm i nanocrane\n```\n\n## Example\n\n```javascript\nvar app = require('./index.js')\nvar nanocrane = require('nanocrane')\n\nvar content = {\n  '/': { title: 'home' },\n  '/about': { title: 'about' }\n}\nvar template = `\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003e\u003c!-- @title --\u003e\u003c/title\u003e\n    \u003c!-- @state --\u003e\n  \u003c/head\u003e\n  \u003c!-- @content --\u003e\n\u003c/html\u003e\n`\n\nnanocrane(app, { content: content }, template)\n```\n\n## Usage\n\n### `nanocrane(app, state, htmlString, options)`\n\n`app` is a mounted Choo application, `state` is an object that'll be forwarded to Choo's state, `htmlString` is the template of the outputted HTML files. Returns a `Promise`.\n\n`state.content` must be set and follow [`nanocontent`](https://github.com/jondashkyle/nanocontent)'s basic structure.\n\nIn the template it'll replace the following:\n\n- `\u003c!-- @content --\u003e` ― with the HTML output of the app\n- `\u003c!-- @state --\u003e` ― with a script element that sets the initial state for Choo\n- `\u003c!-- @title --\u003e` ― with the title of the current page\n\nOptions:\n```\n{\n  clear: bool - whether to clear output path (default: true),\n  copy: array - paths to copy to output,\n  output: string,\n  outputRoute: function - called on every route with `(route, html, options)` (default: write to output directory),\n  verbose: bool\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodedninja%2Fnanocrane","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkodedninja%2Fnanocrane","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodedninja%2Fnanocrane/lists"}