{"id":16860500,"url":"https://github.com/webpro/requirejs-handlebars","last_synced_at":"2025-09-04T13:45:45.987Z","repository":{"id":8744621,"uuid":"10422419","full_name":"webpro/requirejs-handlebars","owner":"webpro","description":"Simple Handlebars plugin for RequireJS","archived":false,"fork":false,"pushed_at":"2013-12-01T15:39:55.000Z","size":152,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-01T22:49:07.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"kengyugrant/HTML-mockup-WordPressThemeDesign3","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webpro.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-06-01T13:02:09.000Z","updated_at":"2020-05-06T15:27:25.000Z","dependencies_parsed_at":"2022-09-03T08:43:58.903Z","dependency_job_id":null,"html_url":"https://github.com/webpro/requirejs-handlebars","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Frequirejs-handlebars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Frequirejs-handlebars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Frequirejs-handlebars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Frequirejs-handlebars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpro","download_url":"https://codeload.github.com/webpro/requirejs-handlebars/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239580729,"owners_count":19662810,"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-10-13T14:24:59.012Z","updated_at":"2025-02-19T01:31:37.257Z","avatar_url":"https://github.com/webpro.png","language":"JavaScript","readme":"# requirejs-handlebars\n\nSimple Handlebars plugin for RequireJS.\n\n* Requires the official `text!` plugin.\n* Like the offical `text!` plugin, include the file extension in the module id.\n* For (optimized) builds using r.js, make sure to\n\t* **Install Handlebars from npm** (not Bower or [website](http://handlebarsjs.com)).\n\t* Include the **runtime** version of Handlebars.\n* Supports preprocessing of templates before they are precompiled.\n\n## Example usage\n\n    define(['hb!myTemplate.tpl'], function(myTemplate) {\n\n        var html = myTemplate({name:'John Doe'});\n\n    });\n\n## Partials\n\nThis plugin has no automatic partial registration (by design).\n\n    define(['hb!myTemplate.tpl', 'hb!myPartial.tpl'], function(myTemplate, myPartial) {\n\n        var html = myTemplate({name:'John Doe'}, {\n            partials: {\n                myPartial: myPartial\n            }\n        });\n\n    });\n\n## Example config\n\nHandlebars includes AMD builds since v1.1.0. Use a `package` config:\n\n\trequire.config({\n\t\tpaths: {\n\t\t\ttext: 'lib/text/text',\n\t\t\thb: 'lib/requirejs-handlebars/hb',\n\t\t\t'handlebars.runtime': 'node_modules/handlebars/handlebars.runtime.amd'\n\t\t},\n\t\tpackages: [\n\t\t\t{\n\t\t\t\tname: 'handlebars',\n\t\t\t\tlocation: 'node_modules/handlebars/dist/amd',\n\t\t\t\tmain: './handlebars'\n\t\t\t}\n\t\t]\n\t});\n\nUsing a version of Handlebars lower than v1.1.0? Then use a configuration like this:\n\n    require.config({\n        paths: {\n            text: 'lib/requirejs-text/text',\n            handlebars: 'node_modules/handlebars/dist/handlebars',\n            hb: 'lib/requirejs-handlebars/hb'\n        },\n        shim: {\n            handlebars: {\n                exports: 'Handlebars'\n            }\n        }\n    });\n\n## Handlebars runtime\n\nThe Handlebars runtime is much smaller than the full version, and it's made to render pre-compiled templates.\nIt's highly efficient to use pre-compiled templates and the runtime template engine in production.\n\nPre-compiled templates use `handlebars.runtime` as a dependency.\n\nStill using a version of Handlebars lower than v1.1.0? Then override the path for `handlebars`, e.g.:\n\n        paths: {\n            handlebars: 'node_modules/handlebars/dist/handlebars.runtime'\n        }\n\n## Preprocessing\n\nThe plugin allows to process the data before it gets precompiled by utilizing the `preProcess` configuration option:\n\n\trequire.config({\n\t\tconfig: {\n\t\t\thb: {\n\t\t\t\tpreProcess: function(done, options, data) {\n\t\t\t\t\tdone(modifiedData);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\nIt's like a two-phase pre-compilation that includes your custom rendering, and then let Handlebars precompile the resulting template. This is very useful for including e.g. translated data (i18n) in your precompiled templates.\n\nThe benefit lies in the performance win: no template helper needed at runtime in the optimized build, since the processed (translated) text is already there. This way, the overhead of including the dictionary file and the template helper calls is removed.\n\nSee [requirejs-handlebars-i18n-example](https://github.com/webpro/requirejs-handlebars-i18n-example) for an example.\n\n## License\n\n[MIT](http://webpro.mit-license.org)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpro%2Frequirejs-handlebars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpro%2Frequirejs-handlebars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpro%2Frequirejs-handlebars/lists"}