{"id":21989073,"url":"https://github.com/imweb/express-micro-tpl","last_synced_at":"2026-04-11T11:03:00.593Z","repository":{"id":22196066,"uuid":"25528412","full_name":"imweb/express-micro-tpl","owner":"imweb","description":null,"archived":false,"fork":false,"pushed_at":"2014-11-02T16:36:53.000Z","size":140,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-08-28T14:45:45.627Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imweb.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-21T14:57:16.000Z","updated_at":"2014-11-01T16:03:03.000Z","dependencies_parsed_at":"2022-08-05T16:00:54.099Z","dependency_job_id":null,"html_url":"https://github.com/imweb/express-micro-tpl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/imweb/express-micro-tpl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Fexpress-micro-tpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Fexpress-micro-tpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Fexpress-micro-tpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Fexpress-micro-tpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imweb","download_url":"https://codeload.github.com/imweb/express-micro-tpl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Fexpress-micro-tpl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31677819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T08:18:19.405Z","status":"ssl_error","status_checked_at":"2026-04-11T08:17:08.892Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-11-29T19:27:37.887Z","updated_at":"2026-04-11T11:03:00.579Z","avatar_url":"https://github.com/imweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"express-micro-tpl\n=================\n\n\u003e `micro-tpl`的express插件，可使express支持micro-tpl模版。\n\n使用\n----\n\n```javascript\nvar express = require('express')\n  , tpl = require('express-micro-tpl');\n\nexpress()\n  .set('views', __dirname + '/views')\n  .set('view engine', 'html')\n  .engine('html', tpl.__express)\n  .get('/', function (req, res) {\n    // render views/index.html\n    res.render('index', { user: req.user });\n  });\n```\n\n\n基本功能\n--------\n\n#### 执行脚本\n\n```html\n\u003c% \n// you javascript code here\nconsole.log('hello world'); \n%\u003e\n```\n\n#### 返回字符\n\n```html\n\u003cp\u003e\u003c%='hello'%\u003e\u003cp\u003e\n```\n会返回`\u003cp\u003ehello\u003c/p\u003e`。\n\n#### 转义字符\n\n```html\n\u003cp\u003e\u003c%=='\u003cp\u003ehello\u003c/p\u003e'%\u003e\u003c/p\u003e\n```\n\n#### include模版\n\n```html\n\u003c%=include('./tpl.html')(data)%\u003e\n```\n会include相对于本模版的tpl.html文件，可以多重include，发生循环引用时会抛出错误。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimweb%2Fexpress-micro-tpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimweb%2Fexpress-micro-tpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimweb%2Fexpress-micro-tpl/lists"}