{"id":21842981,"url":"https://github.com/ullmark/grunt-hogan-client","last_synced_at":"2026-05-19T02:38:32.473Z","repository":{"id":5657027,"uuid":"6866161","full_name":"ullmark/grunt-hogan-client","owner":"ullmark","description":null,"archived":false,"fork":false,"pushed_at":"2012-11-29T12:29:49.000Z","size":121,"stargazers_count":0,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-26T08:45:37.775Z","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/ullmark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-26T14:01:51.000Z","updated_at":"2013-11-03T02:18:36.000Z","dependencies_parsed_at":"2022-08-31T08:31:46.041Z","dependency_job_id":null,"html_url":"https://github.com/ullmark/grunt-hogan-client","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/ullmark%2Fgrunt-hogan-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ullmark%2Fgrunt-hogan-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ullmark%2Fgrunt-hogan-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ullmark%2Fgrunt-hogan-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ullmark","download_url":"https://codeload.github.com/ullmark/grunt-hogan-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244825655,"owners_count":20516592,"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:54.799Z","updated_at":"2026-05-19T02:38:32.434Z","avatar_url":"https://github.com/ullmark.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-hogan-client\n\n\u003e Compile Hogan Templates into ready to use script include.\n\n## Getting Started\nInstall this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-hogan-client`\n\nThen add this line to your project's `grunt.js` gruntfile:\n\n```javascript\ngrunt.loadNpmTasks('grunt-hogan-client');\n```\n\n[grunt]: http://gruntjs.com/\n[getting_started]: https://github.com/gruntjs/grunt/blob/master/docs/getting_started.md\n\n## Example\ngiven the following config and template\n### config\n```javascript\n  hoganclient: {\n    options: {\n      variable: 'window.tmpl'\n    }\n    src: ['templates/**/*.hogan'],\n    dest: 'dist/tmpl.js' \n  }\n```\n### templates\n#### templates/item.hogan\n```html\n\u003cli\u003e\n  \u003ch2\u003e{{title}}\u003ch2\u003e\n  \u003cp\u003e{{text}}\u003c/p\u003e\n\u003c/li\u003e\n```\n#### templates/list.hogan\n```html\n\u003cul id=\"a-list\"\u003e\n{{#items}}\n  {{\u003eitem}}\n{{/items}}\n\u003c/ul\u003e\n```\n\nwill output the following script file\n#### dist/tmpl.js\n```javascript\nwindow.tmpl=window.tmpl||{};\nwindow.tmpl.item=Hogan.compile('\u003cli\u003e\u003ch2\u003e{{title}}\u003c/h2\u003e\u003cp\u003e{{text}}\u003c/p\u003e\u003c/li\u003e');\nwindow.tmpl.list=Hogan.compile('\u003cul id=\"a-list\"\u003e{{#items}}{{\u003eitem}}{{/items}}\u003c/ul\u003e');\n```\nready to use/include/concat etc in your app like this.\n\n```javascript\ntmpl.list.render({ items: [] });\n```\n\n### Wrapping the templates.\nI made this plugin for a very specific case where I also needed to wrap\nthe templates in some code due to async loading of Hogan using\n[head.js](http://headjs.com/).\n\nSince this task is a code generator I decided to add the **wrap**\nproperty to the options. \n\n#### config\n```javascript\noptions: {\n  wrap: {\n    start: 'head.ready(function() {',\n    end: '});'\n  }\n}\n```\n\n## Todo\nI guess there will be need to tweek the regex that cleans the template.\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][grunt].\n\n## Release History\n_(Nothing yet)_\n\n## License\nCopyright (c) 2012 Markus Ullmark  \nLicensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fullmark%2Fgrunt-hogan-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fullmark%2Fgrunt-hogan-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fullmark%2Fgrunt-hogan-client/lists"}