{"id":15784917,"url":"https://github.com/jzwood/pauperjs","last_synced_at":"2025-03-31T17:26:10.896Z","repository":{"id":85594766,"uuid":"140900993","full_name":"jzwood/PauperJs","owner":"jzwood","description":"A poor man's client-side templating engine","archived":false,"fork":false,"pushed_at":"2018-10-01T03:54:56.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T11:13:57.470Z","etag":null,"topics":["micro-library","templating","templating-engine"],"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/jzwood.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-13T23:26:53.000Z","updated_at":"2018-10-01T03:54:57.000Z","dependencies_parsed_at":"2023-04-03T23:46:33.672Z","dependency_job_id":null,"html_url":"https://github.com/jzwood/PauperJs","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"28974b9bc0da3dd3f7c6a6f958c5e05a8dcc5e3c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jzwood%2FPauperJs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jzwood%2FPauperJs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jzwood%2FPauperJs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jzwood%2FPauperJs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jzwood","download_url":"https://codeload.github.com/jzwood/PauperJs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246507118,"owners_count":20788767,"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":["micro-library","templating","templating-engine"],"created_at":"2024-10-04T20:06:30.825Z","updated_at":"2025-03-31T17:26:10.878Z","avatar_url":"https://github.com/jzwood.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PauperJs\nis a micro-library for client-side templating.\n\n![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=for-the-badge)\n\n## API\nPauper transforms the [textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) of every `\u003crender\u003e` element in your markup into a _function_ and replaces the [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML) of that element with the returned value of that _function_ (see [demo](https://jzwood.github.io/PauperJs/demo/)).\n\nTo illustrate, consider the following markup:\n```\n\u003ch1\u003e\n  \u003crender\u003e\n    const today = (new Date()).getDay();\n    const week = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];\n    const party = today === 0 || today === 6;\n    return `It's ${week[today]}${party ? '—  gotta party! 🍹' : '. Got to work. 🖨'}`;\n  \u003c/render\u003e\n\u003c/h1\u003e\n```\n\non Saturday this would render as\n```\n\u003ch1\u003e\n  \u003crender\u003eIt's Saturday — gotta party! 🍹\u003c/render\u003e\n\u003c/h1\u003e\n```\nand on Monday as\n```\n\u003ch1\u003e\n  \u003crender\u003eIt's Monday. Got to work. 🖨\u003c/render\u003e\n\u003c/h1\u003e\n```\n\n## Promises\nWant to render async data? No problem. Pauper will correctly populate the render field if the `\u003crender\u003e` function returns a promise.\n\n## No Javascript\nBrowsers usually have Javascript turned on but when they don't you want to be prepared. To do this you can place static fallback copy inside of a `\u003cnorender\u003e` element.\n\n```\n\u003cp\u003eWelcome to my webpage!\n  \u003cnorender\u003ePlz turn on JavaScript to get the best experience!\u003c/norender\u003e\n  \u003crender\u003e return ajax('get:puppy_pics:all');\u003c/render\u003e\n\u003c/p\u003e\n```\n\nWhen Javascript is disabled in the client's browser PauperJs won't run (_obviously_) which means that in order for the fallback to work correctly the following css must be added to the project manually.\n\n```css\nrender:not(.rendered) {\n  display: none;\n}\n```\n\nWhen the render tags are being rendered PauperJs adds the class `rendered` which will allow them to avoid the `display: none;` selector. PauperJs will handle removing the `\u003cnorender\u003e` tags.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjzwood%2Fpauperjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjzwood%2Fpauperjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjzwood%2Fpauperjs/lists"}