{"id":13781216,"url":"https://github.com/thinkjs/think-view-ejs","last_synced_at":"2025-08-19T04:44:50.391Z","repository":{"id":73609647,"uuid":"84774353","full_name":"thinkjs/think-view-ejs","owner":"thinkjs","description":"compile view templates with EJS for ThinkJS 3.x","archived":false,"fork":false,"pushed_at":"2019-12-23T04:46:15.000Z","size":10,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-27T08:53:10.695Z","etag":null,"topics":["ejs","think-adapter","thinkjs3","view"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"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/thinkjs.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}},"created_at":"2017-03-13T02:12:10.000Z","updated_at":"2021-12-24T02:31:45.000Z","dependencies_parsed_at":"2024-01-15T19:58:26.681Z","dependency_job_id":null,"html_url":"https://github.com/thinkjs/think-view-ejs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/thinkjs/think-view-ejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-view-ejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-view-ejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-view-ejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-view-ejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkjs","download_url":"https://codeload.github.com/thinkjs/think-view-ejs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-view-ejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271103031,"owners_count":24699638,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","think-adapter","thinkjs3","view"],"created_at":"2024-08-03T18:01:23.934Z","updated_at":"2025-08-19T04:44:50.356Z","avatar_url":"https://github.com/thinkjs.png","language":"JavaScript","readme":"# think-view-ejs\n[![Build Status](https://img.shields.io/travis/thinkjs/think-view-ejs/master.svg?style=flat-square)](https://travis-ci.org/thinkjs/think-view-ejs)\n[![Coverage Status](https://img.shields.io/coveralls/thinkjs/think-view-ejs/master.svg?style=flat-square)](https://coveralls.io/github/thinkjs/think-view-ejs?branch=master)\n[![npm](https://img.shields.io/npm/v/think-view-ejs.svg?colorB=brightgreen\u0026style=flat-square)](https://www.npmjs.com/package/think-view-ejs)\n\n\nCompile view templates with EJS for ThinkJS 3.x.\n\n\n## Install\n\n```\nnpm install think-view-ejs\n```\n## Usage\n\nedit config file `src/config/adapter.js`, add options for ejs adapter:\n\n```js\nconst ejs = require('think-view-ejs');\nexports.view = {\n  type: 'ejs',\n  common: {\n    viewPath: path.join(think.ROOT_PATH, 'view'),\n    extname: '.html',\n    sep: '_' //seperator between controller and action\n  },\n  ejs: {\n    //options\n    handle: ejs,\n    beforeRender: (ejs, handleOptions) =\u003e {\n      //do something before render the template.\n    }\n  }\n}\n```\n\n\n\n### Options\n\nDefault options:\n\n```js\nconst defaultOptions = {\n  cache: true\n}\n```\n\nYou can override it and add other options by editing file  `src/config/adapter.js` :\n\n```js\nexports.view = {\n  type: 'ejs',\n  ejs: {\n    handle: ejs,\n    options: {\n      //override `cache` option\n      cache: false\n    },\n    beforeRender: (ejs, handleOptions) =\u003e {\n      //do something before render the template.\n    }\n  }\n}\n```\n\nPlease refer to [https://github.com/mde/ejs#options](https://github.com/mde/ejs#options) for more information on EJS options.\n\n### beforeRender\n\n`beforeRender`  is a function that you can handle something before rendering the template file. It exposes 2 parameters:\n\n*  `ejs` — the original `ejs` module\n* `handleOptions` — current configure of ejs adapter\n\n","funding_links":[],"categories":["Adapters"],"sub_categories":["view"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkjs%2Fthink-view-ejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkjs%2Fthink-view-ejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkjs%2Fthink-view-ejs/lists"}