{"id":13799065,"url":"https://github.com/JiangJie/koa-swig-render","last_synced_at":"2025-05-13T06:32:04.006Z","repository":{"id":25761853,"uuid":"29199951","full_name":"JiangJie/koa-swig-render","owner":"JiangJie","description":"Koa view render based on Swig, support tags, filters, and extensions.","archived":false,"fork":false,"pushed_at":"2015-01-14T07:01:55.000Z","size":152,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-09T18:32:54.687Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/JiangJie.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":"2015-01-13T16:43:02.000Z","updated_at":"2023-02-25T12:57:58.000Z","dependencies_parsed_at":"2022-08-23T11:30:45.655Z","dependency_job_id":null,"html_url":"https://github.com/JiangJie/koa-swig-render","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiangJie%2Fkoa-swig-render","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiangJie%2Fkoa-swig-render/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiangJie%2Fkoa-swig-render/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiangJie%2Fkoa-swig-render/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JiangJie","download_url":"https://codeload.github.com/JiangJie/koa-swig-render/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225183807,"owners_count":17434187,"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":[],"created_at":"2024-08-04T00:00:58.471Z","updated_at":"2024-11-18T13:31:49.548Z","avatar_url":"https://github.com/JiangJie.png","language":"JavaScript","funding_links":[],"categories":["仓库"],"sub_categories":["中间件"],"readme":"# koa-swig-render\n\n[![NPM version][npm-img]][npm-url]\n[![Build status][travis-img]][travis-url]\n[![Test coverage][coveralls-img]][coveralls-url]\n[![License][license-img]][license-url]\n[![Dependency status][david-img]][david-url]\n\nForked from [koa-swig](https://github.com/koa-modules/koa-swig), but the usage is a little difference. That is ~~`render(app, {});`~~`app.use(render());`\n\n[Koa][] view render based on [Swig][], support tags, filters, and extensions.\n\n[![NPM](https://nodei.co/npm/koa-swig-render.png?downloads=true)](https://nodei.co/npm/koa-swig-render/)\n\n### Usage\n\n#### Install\n\n```\nnpm install koa-swig-render\n```\n\n#### Features\n\n* First, automatically merge `ctx.state` from koa 0.14.\n* Second, automatically merge `ctx.flash`.\n* Finally, merge custom locals.\n\n#### Example\n\n```js\nvar koa = require('koa');\nvar render = require('koa-swig');\nvar app = koa();\n\napp.use(render({\n  root: path.join(__dirname, 'views'),\n  autoescape: true,\n  cache: 'memory', // disable, set to false\n  ext: 'html',\n  locals: locals,\n  filters: filters,\n  tags: tags,\n  extensions: extensions\n}));\n\napp.use(function *() {\n  yield* this.render('index');\n});\n\napp.listen(2333);\n```\n\n#### Settings\n\n* [swig options](http://paularmstrong.github.io/swig/docs/api/#SwigOpts)\n  - autoescape\n  - cache\n  - locals\n  - varControls\n\n* filters: swig custom [filters](http://paularmstrong.github.io/swig/docs/extending/#filters)\n\n* tags: swig custom [tags](http://paularmstrong.github.io/swig/docs/extending/#tags)\n\n* extensions: add extensions for custom tags\n\n* ext: default view extname\n\n* root: view root directory\n\n* writeBody: default(true) auto write body and response\n\n\n#### Others\n\n* [swig-extras](https://github.com/paularmstrong/swig-extras) A collection of handy tags, filters, and extensions for Swig.\n\n### Licences\n\nMIT\n\n[koa]: http://koajs.com\n[swig]: http://paularmstrong.github.io/swig/\n\n[npm-img]: https://img.shields.io/npm/v/koa-swig-render.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/koa-swig-render\n[travis-img]: https://img.shields.io/travis/JiangJie/koa-swig-render.svg?style=flat-square\n[travis-url]: https://travis-ci.org/JiangJie/koa-swig-render\n[coveralls-img]: https://img.shields.io/coveralls/JiangJie/koa-swig-render.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/JiangJie/koa-swig-render?branch=master\n[license-img]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square\n[license-url]: LICENSE\n[david-img]: https://img.shields.io/david/JiangJie/koa-swig-render.svg?style=flat-square\n[david-url]: https://david-dm.org/JiangJie/koa-swig-render\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJiangJie%2Fkoa-swig-render","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJiangJie%2Fkoa-swig-render","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJiangJie%2Fkoa-swig-render/lists"}