{"id":21033451,"url":"https://github.com/electerious/rosid-handler-ejs","last_synced_at":"2025-05-15T13:32:04.072Z","repository":{"id":65998945,"uuid":"48661202","full_name":"electerious/rosid-handler-ejs","owner":"electerious","description":"Load EJS templates and render them.","archived":false,"fork":false,"pushed_at":"2022-01-08T15:50:34.000Z","size":92,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T16:38:51.456Z","etag":null,"topics":["ejs","html","rosid","transpiler"],"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/electerious.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-12-27T21:30:15.000Z","updated_at":"2022-01-08T15:50:37.000Z","dependencies_parsed_at":"2023-06-06T00:45:13.380Z","dependency_job_id":null,"html_url":"https://github.com/electerious/rosid-handler-ejs","commit_stats":{"total_commits":177,"total_committers":4,"mean_commits":44.25,"dds":"0.10169491525423724","last_synced_commit":"0ecf7b5a3e93aa7ffc6c8f2c1e144ef361e2bf8d"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Frosid-handler-ejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Frosid-handler-ejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Frosid-handler-ejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electerious%2Frosid-handler-ejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electerious","download_url":"https://codeload.github.com/electerious/rosid-handler-ejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254349457,"owners_count":22056351,"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":["ejs","html","rosid","transpiler"],"created_at":"2024-11-19T12:57:13.028Z","updated_at":"2025-05-15T13:32:04.062Z","avatar_url":"https://github.com/electerious.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rosid-handler-ejs\n\n[![Travis Build Status](https://travis-ci.org/electerious/rosid-handler-ejs.svg?branch=master)](https://travis-ci.org/electerious/rosid-handler-ejs) [![Coverage Status](https://coveralls.io/repos/github/electerious/rosid-handler-ejs/badge.svg?branch=master)](https://coveralls.io/github/electerious/rosid-handler-ejs?branch=master)  [![Dependencies](https://david-dm.org/electerious/rosid-handler-ejs.svg)](https://david-dm.org/electerious/rosid-handler-ejs#info=dependencies) [![Greenkeeper badge](https://badges.greenkeeper.io/electerious/rosid-handler-ejs.svg)](https://greenkeeper.io/)\n\nA function that loads an EJS file and transforms it to HTML.\n\n## Install\n\n```\nnpm install rosid-handler-ejs\n```\n\n## Usage\n\n### API\n\n```js\nconst handler = require('rosid-handler-ejs')\n\nhandler('index.ejs').then((data) =\u003e {})\nhandler('index.xml').then((data) =\u003e {})\nhandler('index.ejs', { optimize: true }).then((data) =\u003e {})\nhandler('index.ejs', { data: { key: 'value' } }).then((data) =\u003e {})\nhandler('index.ejs', { data: 'data.json' }).then((data) =\u003e {})\n```\n\n### Rosid\n\nAdd the following object to your `rosidfile.json`, `rosidfile.js` or [routes array](https://github.com/electerious/Rosid/blob/master/docs/Routes.md). `rosid-handler-ejs` will transform all matching EJS files in your source folder to HTML.\n\n```json\n{\n\t\"name\"    : \"EJS\",\n\t\"path\"    : \"[^_]*.{html,ejs}*\",\n\t\"handler\" : \"rosid-handler-ejs\"\n}\n```\n\n```html\n\u003c!-- index.ejs --\u003e\n\u003ch1\u003eHello \u003c%= 'World' %\u003e\u003c/h1\u003e\n```\n\n```html\n\u003c!-- index.html (output) --\u003e\n\u003ch1\u003eHello World\u003c/h1\u003e\n```\n\n## Parameters\n\n- `filePath` `{String}` Path to file.\n- `opts` `{?Object}` Options.\n\t- `optimize` `{?Boolean}` - Optimize output. Defaults to `false`.\n\t- `data` `{?Object|String}` - Data used to render the template. Defaults to `{}`.\n\t- `localOverwrites` `{?Boolean}` - Enable or disable [custom data per file](#custom-data-per-file). Defaults to `true`.\n\n## Returns\n\n- `{Promise\u003cString|Buffer\u003e}` The transformed file content.\n\n## Miscellaneous\n\n### Data\n\nThe data in `opts.data` will be used to render your template. `opts.data` can either be an object (the data) or a string (path to data file). `rosid-handler-ejs` tries to require the path when a string is specified instead of an object. The path must be absolute or relative to the current working directory.\n\n### Custom data per file\n\nCreate a file with the name `filename.data.json` or `filename.data.js` along your `filename.ejs` to add or overwrite data from `opts.data`. You can disable this behaviour with the `localOverwrites` option.\n\n### Environment\n\n`rosid-handler-ejs` passes a variable called `environment` to your template. `environment` is `prod` when `opts.optimize` is `true` and `dev` when `opts.optimize` is `false`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felecterious%2Frosid-handler-ejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felecterious%2Frosid-handler-ejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felecterious%2Frosid-handler-ejs/lists"}