{"id":14982437,"url":"https://github.com/rogeriopvl/gulp-ejs","last_synced_at":"2025-10-27T00:35:57.946Z","repository":{"id":13033037,"uuid":"15712730","full_name":"rogeriopvl/gulp-ejs","owner":"rogeriopvl","description":"🎨 Gulp plugin for ejs templates","archived":false,"fork":false,"pushed_at":"2024-10-11T05:35:48.000Z","size":404,"stargazers_count":88,"open_issues_count":3,"forks_count":34,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-08T16:02:43.928Z","etag":null,"topics":["ejs","gulp","gulp-plugin","gulpplugin"],"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/rogeriopvl.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":"2014-01-07T18:28:33.000Z","updated_at":"2023-12-19T17:36:45.000Z","dependencies_parsed_at":"2024-12-08T05:03:12.248Z","dependency_job_id":null,"html_url":"https://github.com/rogeriopvl/gulp-ejs","commit_stats":{"total_commits":217,"total_committers":17,"mean_commits":"12.764705882352942","dds":0.5253456221198156,"last_synced_commit":"5973ceaf86e296a970530269f8331d19a9fdd118"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogeriopvl%2Fgulp-ejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogeriopvl%2Fgulp-ejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogeriopvl%2Fgulp-ejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogeriopvl%2Fgulp-ejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rogeriopvl","download_url":"https://codeload.github.com/rogeriopvl/gulp-ejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478186,"owners_count":22077675,"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","gulp","gulp-plugin","gulpplugin"],"created_at":"2024-09-24T14:05:24.772Z","updated_at":"2025-10-27T00:35:52.909Z","avatar_url":"https://github.com/rogeriopvl.png","language":"JavaScript","readme":"# gulp-ejs [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]\n\n\u003e ejs plugin for [gulp](https://github.com/wearefractal/gulp)\n\n## Usage\n\nFirst, install `gulp-ejs` as a development dependency:\n\n```shell\nnpm install --save-dev gulp-ejs\n```\n\nThen, add it to your `gulpfile.js`:\n\n```javascript\nvar ejs = require(\"gulp-ejs\")\n\ngulp.src(\"./templates/*.ejs\")\n\t.pipe(ejs({\n\t\tmsg: \"Hello Gulp!\"\n\t}))\n\t.pipe(gulp.dest(\"./dist\"))\n```\n\n### Watch mode error handling (for gulp v3 or below)\n\nIf you want to use `gulp-ejs` in a watch/livereload task, you may want to avoid gulp exiting on error when, for instance, a partial file is `ENOENT` or an ejs syntax error.\n\nHere's an example on how to make it work:\n\n```javascript\nvar ejs = require('gulp-ejs')\nvar log = require('fancy-log')\n\ngulp.src('./templates/*.ejs')\n\t.pipe(ejs({\n\t\tmsg: 'Hello Gulp!'\n\t}).on('error', log))\n\t.pipe(gulp.dest('./dist'))\n```\nThis will make gulp log the error and continue normal execution.\n\n**Please note that you don't need to do this for Gulp v4.**\n\n### Accessing the ejs object\n\nThe ejs object is also exported and you can use it to configure ejs:\n\n```javascript\nconst ejs = require('gulp-ejs')\n\nejs.__EJS__.fileLoader = function () { /* custom file loader */ }\n```\n\n**Note:** As of version 4, the exported ejs object was renamed from `ejs` to `__EJS__`.\n\n### Async rendering (requires runtime support)\n\nSince ejs [v2.5.8](https://github.com/mde/ejs/releases/tag/v2.5.8) added support for promise/async-await `renderFile`, you can now use this option with gulp-ejs v4.1.0.\n\nYou can use async/await in your ejs templates by passing `{ async: true }` in the ejs options hash:\n\n```javascript\nconst ejs = require('gulp-ejs')\n\nasync function foobar() { /* async task */ }\n\ngulp.src('./templates/*.ejs')\n\t.pipe(ejs({ foobar }, { async: true }))\n\t.pipe(gulp.dest('./dist'))\n```\n\nThen in your templates use `await` to call async functions. Here's an example:\n\n```javascript\n\u003c%= await foobar() %\u003e\n```\n\n## API\n\n### ejs(data, options)\n\n#### data\nType: `hash`\nDefault: `{}`\n\nA hash object where each key corresponds to a variable in your template.\n\n**Note:** As of `v1.2.0`, `file.data` is supported as a way of passing data into ejs. See [this](https://github.com/colynb/gulp-data#note-to-gulp-plugin-authors). If both `file.data` and `data` are passed, they are merged (`data` works as default for ejs options and `file.data` overrides it.)\n\n#### options\nType: `hash`\nDefault: `{}`\n\nA hash object for ejs options.\n\nFor more info on `ejs` options, check the [project's documentation](https://github.com/mde/ejs).\n\n### Renaming file extensions\n\nAs of version 4, the third api parameter `settings` was removed. You can no longer provide an extension. This is because it falls out of the scope of `gulp-ejs`. So if you need to save the file with a different extension you can use [gulp-rename](https://npmjs.com/package/gulp-rename).\n\nHere's an example for template files with `.ejs` extension that are rendered into `.html` files:\n\n```javascript\nconst ejs = require('gulp-ejs')\nconst rename = require('gulp-rename')\n\ngulp.src('./templates/*.ejs')\n  .pipe(ejs({ title: 'gulp-ejs' }))\n  .pipe(rename({ extname: '.html' }))\n  .pipe(gulp.dest('./dist'))\n```\n\n## License\n\n[MIT License](http://en.wikipedia.org/wiki/MIT_License)\n\n[npm-url]: https://npmjs.org/package/gulp-ejs\n[npm-image]: https://badge.fury.io/js/gulp-ejs.png\n\n[travis-url]: http://travis-ci.org/rogeriopvl/gulp-ejs\n[travis-image]: https://secure.travis-ci.org/rogeriopvl/gulp-ejs.png?branch=master\n\n[depstat-url]: https://david-dm.org/rogeriopvl/gulp-ejs\n[depstat-image]: https://david-dm.org/rogeriopvl/gulp-ejs.png\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogeriopvl%2Fgulp-ejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frogeriopvl%2Fgulp-ejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogeriopvl%2Fgulp-ejs/lists"}