{"id":17445948,"url":"https://github.com/jamen/pixie","last_synced_at":"2025-09-25T01:30:54.941Z","repository":{"id":57325151,"uuid":"55815067","full_name":"jamen/pixie","owner":"jamen","description":"Tiny template functions.","archived":false,"fork":false,"pushed_at":"2018-04-05T03:26:37.000Z","size":106,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-12T09:42:33.711Z","etag":null,"topics":["engine","fast","fragments","parse","pixie","small","template","templating","tiny"],"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/jamen.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":"2016-04-08T23:11:08.000Z","updated_at":"2023-08-31T09:58:59.000Z","dependencies_parsed_at":"2022-09-18T22:11:29.403Z","dependency_job_id":null,"html_url":"https://github.com/jamen/pixie","commit_stats":null,"previous_names":["pixiejs/pixie"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpixie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpixie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpixie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpixie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamen","download_url":"https://codeload.github.com/jamen/pixie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234143350,"owners_count":18786140,"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":["engine","fast","fragments","parse","pixie","small","template","templating","tiny"],"created_at":"2024-10-17T18:18:34.669Z","updated_at":"2025-09-25T01:30:54.659Z","avatar_url":"https://github.com/jamen.png","language":"JavaScript","readme":"\n\u003ch1\u003e\n  \u003cimg src=https://cdn.rawgit.com/pixiejs/pixie/master/pixie.svg alt=pixie height=64\u003e\n\u003c/h1\u003e\n\n\u003e Tiny template engine (422 bytes uglified and gziped)\n\n```js\nconst { parse, compile } = require('pixie')\n\nconst template = parse('foo {{bar}} baz', '{{', '}}')\n// =\u003e [['foo ', ' baz'], ['bar']]\n\ncompile(template, { bar: 'Baaar!' })\n// =\u003e 'foo Baaar! baz'\n```\n\n## Install\n\n```sh\nnpm i pixie\n```\n\n## Usage\n\n### `parse(source, open, close)`\n\nConverts a string to a template.\n\n- `source`: template string source being parsed\n- `open`: tag for opening expressions\n- `close`: tag for closing expressions\n\n```js\n// Parse with tags\nparse('Hello {{world}} foo {{bar}} baz.', '{{', '}}')\n\n// Parse with alternate tags\nparse('Hello \u003c%world%\u003e!', '\u003c%', '%\u003e')\n```\n\n### `compile(template, data)`\n\nReplaces values from an object by key.\n\n- `template`: template object that was returned from `parse`\n- `data`: object or array to insert into the expressions\n\n```js\nvar template = parse('foo {{bar}} baz {{qux}}')\n\ncompile(template, { bar: 'baaar', qux: 'quuux' })\n// 'foo baaar baz quuux'\n```\n\n### `render(source, data, open, close)`\n\nAn alternative to doing `compile(parse(source, open, close), data)`, it is slightly faster and creates no intermediate template.\n\n```js\nrender('Hello, {{world}}!', { world: 'Earth' }, '{{', '}}')\n// 'Hello Earth!'\n```\n\n### Template structure\n\nGiven some template source:\n\n```\nHello, {{world}}! I am {{person}}.\n```\n\nThis is parsed into a template as `[fragments, expressions]`.  The expressions would be `['world', 'person']`, and the fragments be the data surrounding the expressions `['Hello, ', '! I am ', '.']`.  Compilers interpret these to create their output.\n\n### Command-line Interface\n\nThe package also includes a CLI.  It just parses stdin and compiles stdout.\n\n```sh\npixie --name \"John Doe\" \u003c template.src.md \u003e template.md\n```\n\n## License\n\nMIT \u0026copy; [Jamen Marz](http://jamenmarz.com/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fpixie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamen%2Fpixie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fpixie/lists"}