{"id":16119376,"url":"https://github.com/codingchili/sta-mina","last_synced_at":"2025-03-18T10:31:32.617Z","repository":{"id":57370107,"uuid":"155445195","full_name":"codingchili/sta-mina","owner":"codingchili","description":"minimal static site generator and template literal renderer","archived":false,"fork":false,"pushed_at":"2019-10-11T20:22:37.000Z","size":2040,"stargazers_count":4,"open_issues_count":10,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T09:11:32.124Z","etag":null,"topics":["framework","html5","js","static-site-generator","template-literals"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codingchili.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-30T19:34:50.000Z","updated_at":"2021-09-14T02:53:48.000Z","dependencies_parsed_at":"2022-09-26T16:41:04.686Z","dependency_job_id":null,"html_url":"https://github.com/codingchili/sta-mina","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingchili%2Fsta-mina","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingchili%2Fsta-mina/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingchili%2Fsta-mina/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingchili%2Fsta-mina/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codingchili","download_url":"https://codeload.github.com/codingchili/sta-mina/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243922059,"owners_count":20369339,"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":["framework","html5","js","static-site-generator","template-literals"],"created_at":"2024-10-09T20:53:59.932Z","updated_at":"2025-03-18T10:31:32.258Z","avatar_url":"https://github.com/codingchili.png","language":"JavaScript","readme":"# sta-mina\n[![npm version](https://badge.fury.io/js/static-mina.svg)](https://badge.fury.io/js/static-mina)\n[![Build Status](https://travis-ci.org/codingchili/sta-mina.svg?branch=master)](https://travis-ci.org/codingchili/sta-mina)\n\nMinimal static/dynamic site generator. status: in development, YouTube [demo](https://www.youtube.com/watch?v=ZhInxNGllgM) \n\n![preview](https://raw.githubusercontent.com/codingchili/sta-mina/master/preview.png \"Current snapshot version\")\n\nSample snapshot of a render of the git-project template.\n\n\n## Background\nStamina uses templates that are parsed as template literals. It is a minimal static\nsite generator and web framework in one. With two modes of site generation.\n\n\n## Installing\nInstalling the generator is super easy.\n\n```console\nλ npm install -g static-mina\n```\n\n'stamina' should now be available on your CLI, check it with\n```console\nλ stamina -h\nusage: console.js [-h] [-v] [-f FILE] [-d] [--template TEMPLATE] [--data DATA]\n                  [--configure]\n\nSta-mina static site generator.\n\nOptional arguments:\n  -h, --help            Show this help message and exit.\n  -v, --version         Show program's version number and exit.\n  -f FILE, --file FILE  local file with project settings.\n  -d, --dynamic         generate a dynamic site, default is false.\n  --template TEMPLATE   local .html template.\n  --data DATA           local json/yaml file.\n  --configure           generates project configuration.\n``` \n\nReady to rock!\n\n## Tutorial\n\nExample of a minimal template\n\n```xml\n\u003chtml\u003e\n\u003cstyle\u003e\n    span {\n        color: ${theme.font}\n    }\n\u003c/style\u003e\n\u003cbody bgcolor=\"${theme.bg}\"\u003e\n    \u003cspan\u003e${text.title}\u003c/span\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nA sample data file used to render the template, supports json and yaml.\n```yaml\n---\ntheme:\n  font: red\n  bg: \"#000\"\ntext:\n  title: hello world.\n```\n\nNow, create two files `template.html` to hold the template data and `site.yaml` to hold the data.\n\n\n\nWhen installed we can generate a static site using the following snippet,\n```console\nλ stamina --template template.html --data site.yaml\n```\n\nAlternatively, we can create a dynamically loaded site using this,\n```console\nλ stamina --dynamic --template template.html --data site.yaml\n```\n\nDynamic sites are rendered at runtime, which means that we can point to two templates at \narbitrary locations - maybe you want your site.json to be available in your git repo for example.\n\nAfter running the above commands the generated site will be present under build/site/*.\n\n#### Multi-project setup\nTo create a new project configuration file run the following,\n\n```console\nλ stamina --configure\n```\n\nThis creates the file `stamina.json` in your current directory.\n\n```json\n{\n  \"sites\": [{\n    \"template\": \"path/to/your/template.html\",\n    \"data\": \"path/to/your/data.json\",\n    \"dynamic\": false,\n    \"name\": \"sample-site\",\n    \"web\": \"./web\"\n  }]\n}\n```\n\nSites is a list of sites you want to build, a template and data file needs to be specified.\nName is optional and defaults to the filename of the data file. Dynamic indicates if we are to\ngenerate a dynamic or static site. Web is an optional directory with static resources to copy to the\noutput directory, place your css/js/images there.\n\n#### Building a multi-project setup\nBuild all projects in `stamina.json`\n```console\nλ stamina\n```\n\nBuild all projects in configuration file settings.json,\n```console\nλ stamina -f projects/settings.json\n```\n\nBuild with specified project file and site name,\n```console\nλ stamina -f projects/settings.json --name mywebsite-1\n```\n\n## Linking in multi-site projects\nThe only real feature apart from site generation is linking. Links are resolved at compile\ntime and are used to create multi-site projects.\n\nA link can be created using the framework by invoking the following method, `link(template, data, content)`.\n\ntemplate - a local template file or in the future also a remote file.\ndata \t - a local data file or in the future also a remote file\ncontent  - this is the content of the link that is created.\n\nExample\n```xml\n\u003cdiv class=\"some-css\"\u003e\n\t${link('templates/git-project.html', 'sites/my-project.json', \n\t\t`\u003cdiv\u003eclick me\u003c/div\u003e`\n\t)}\n\u003cdiv\u003e\n```\n\nProduces the following link in static mode:\n\n```xml\n\u003ca href=\"javscript:void(0)\" onmousedown=\"event.which == 1 ? location.href='template' : ''\"\u003e\n\tcontent\n\u003c/a\u003e\n```\nNote that 'template' here will reference a new filename, which is the template rendered with the referenced json file.\n\nA link looks like this in dynamic mode:\n\n```xml\n\u003ca href=\"javscript:void(0)\" onmousedown=\"link_load(template, site)\" onmouseover=\"link_preload(template, site)\"\u003e\n\tcontent\n\u003c/a\u003e\n```\nWhen the link is hovered the loader issues two network requests to fetch the template and jso file.\nWhen a link is clicked in dynamic mode, the template is rendered and a new document is written\nwithout navigating to a new site.\n\nFor sites that don't require multiple templates, we recommend using regular links.\n\n### History\n\nHistory works fine for static pages, when using the link feature in dynamic mode no support is\nimplemted yet. Altough it is planned and is easily implemented in the loader :)\n\n\n## Contributing\n\nAll contributions are welcome, new issues, pull requests and ideas! \n\n[![donate](https://img.shields.io/badge/donate-%CE%9ETH%20/%20%C9%83TC-ff00cc.svg?style=flat\u0026logo=ethereum)](https://commerce.coinbase.com/checkout/673e693e-be6d-4583-9791-611da87861e3)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingchili%2Fsta-mina","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodingchili%2Fsta-mina","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingchili%2Fsta-mina/lists"}