{"id":21842972,"url":"https://github.com/ullmark/requirejs-dot","last_synced_at":"2025-09-06T01:49:15.608Z","repository":{"id":7626584,"uuid":"8985973","full_name":"ullmark/requirejs-doT","owner":"ullmark","description":"Require.js doT plugin","archived":false,"fork":false,"pushed_at":"2013-05-20T08:47:06.000Z","size":160,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T12:05:11.860Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ullmark.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":"2013-03-24T12:51:16.000Z","updated_at":"2018-10-20T08:42:09.000Z","dependencies_parsed_at":"2022-08-31T00:01:12.470Z","dependency_job_id":null,"html_url":"https://github.com/ullmark/requirejs-doT","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ullmark%2Frequirejs-doT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ullmark%2Frequirejs-doT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ullmark%2Frequirejs-doT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ullmark%2Frequirejs-doT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ullmark","download_url":"https://codeload.github.com/ullmark/requirejs-doT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248877983,"owners_count":21176243,"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-11-27T22:13:52.961Z","updated_at":"2025-04-14T12:05:17.229Z","avatar_url":"https://github.com/ullmark.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"require.js [doT][] plugin\n=========================\n\nThis plugins loads dot-templates with [require-text][] during development, and has the capabilities \nto build dependency free optimized versions with [r.js](http://requirejs.org/docs/optimization.html)\n\nUsage\n----------------------\nCreate your template: `persons.dot`\n\n```html\n\u003cul\u003e\n{{~ it.persons :person }}\n  \u003cli\u003e\n    \u003ch2\u003e{{= person.name }}\u003c/h2\u003e\n    \u003ch3\u003e{{= person.age }}\u003c/h3\u003e\n  \u003c/li\u003e\n{{~}}\n\u003c/ul\u003e\n```\n\nUse it:\n```javascript\ndefine(['doT!persons'], function(tmpl) {\n  var data = {\n    persons: [\n      { name: 'foo', age: 30 },\n      { name: 'bar', age: 53 }\n    ]\n  };\n\n  var html = tmpl(data);\n});\n```\n\nInstallation \u0026 Dependencies\n---------------------------\n  - [doT][] \n  - [require-text][]\n\nInstall with [bower][] to get them all. You can also manually \ndownload `doT.js` or clone this repository and get the dependencies in whatever way you \nsee fit.\n\n```\nbower install requirejs-doT\n```\n\nIn your [paths](http://requirejs.org/docs/api.html#config-paths) setup the mappings \nto the dependencies (change to fit your setup).\n\n```javascript\nrequire.config({\n  paths: {\n    doTCompiler:  'components/doT/doT',\n    text:         'components/requirejs-text/text',\n    doT:          'components/requirejs-dot/doT'\n  }\n});\n```\n\nConfig\n-------------------\ntemplateSettings are passed into [doT][].templateSettings.\n\n```javascript\nrequire.config({\n  doT: {\n    ext: '.dot', // extension of the templates, defaults to .dot\n    templateSettings: {\n      evaluate:    /\\{\\{([\\s\\S]+?)\\}\\}/g,\n      interpolate: /\\{\\{=([\\s\\S]+?)\\}\\}/g,\n      encode:      /\\{\\{!([\\s\\S]+?)\\}\\}/g,\n      use:         /\\{\\{#([\\s\\S]+?)\\}\\}/g,\n      define:      /\\{\\{##\\s*([\\w\\.$]+)\\s*(\\:|=)([\\s\\S]+?)#\\}\\}/g,\n      conditional: /\\{\\{\\?(\\?)?\\s*([\\s\\S]*?)\\s*\\}\\}/g,\n      iterate:     /\\{\\{~\\s*(?:\\}\\}|([\\s\\S]+?)\\s*\\:\\s*([\\w$]+)\\s*(?:\\:\\s*([\\w$]+))?\\s*\\}\\})/g,\n      varname: 'it',\n      strip: true,\n      append: true,\n      selfcontained: false\n    }\n  }\n});\n```\n\nOptimized\n-----------------------\nIn a optimized build, the templates is defined as compiled \n[doT][] function. So in optimized mode it doesn't really have dependencies \nat all, not even [doT][].\n\nThe optimized version of the `persons.dot` template above.\n\n```javascript\ndefine(\"doT!persons\",function(){return function(t){var n=\"\u003cul\u003e\",r=t.persons;if(r){var i,s=-1,o=r.length-1;while(s\u003co)i=r[s+=1],n+=\" \u003cli\u003e \u003ch2\u003e\"+i.name+\"\u003c/h2\u003e \u003ch3\u003e\"+i.age+\"\u003c/h3\u003e \u003c/li\u003e\"}return n+=\"\u003c/ul\u003e\",n}})\n```\n\nIf your application doesn't use [require-text][] or [doT][] somewhere else, you can go ahead and \nstub them from the build by using [stubModules](https://github.com/jrburke/r.js/blob/master/build/example.build.js#L295-L308) in your build.\n\n```javascript\nstubModules: ['doTCompiler', 'text', 'doT']\n```\n\nPitfalls\n-------------\n  - Remember to make sure your webserver can serve `.dot`-files during development (Or whatever extension you choose).\n  - Optimizing isn't tested for Rhino yet...\n\nTodo\n-------------\nFigure out more ways to test\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2013 Markus Ullmark\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[doT]: http://olado.github.com/doT/\n[require-text]: https://github.com/requirejs/text\n[bower]: http://twitter.github.com/bower/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fullmark%2Frequirejs-dot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fullmark%2Frequirejs-dot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fullmark%2Frequirejs-dot/lists"}