{"id":20902603,"url":"https://github.com/salsify/broccoli-underscore-template-compiler","last_synced_at":"2026-04-23T15:34:46.333Z","repository":{"id":21936772,"uuid":"25261208","full_name":"salsify/broccoli-underscore-template-compiler","owner":"salsify","description":null,"archived":false,"fork":false,"pushed_at":"2022-03-08T16:32:35.000Z","size":13,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":37,"default_branch":"master","last_synced_at":"2025-02-21T11:03:00.363Z","etag":null,"topics":["npm"],"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/salsify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2014-10-15T15:34:31.000Z","updated_at":"2022-03-08T16:32:35.000Z","dependencies_parsed_at":"2022-08-20T03:21:30.903Z","dependency_job_id":null,"html_url":"https://github.com/salsify/broccoli-underscore-template-compiler","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fbroccoli-underscore-template-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fbroccoli-underscore-template-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fbroccoli-underscore-template-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salsify%2Fbroccoli-underscore-template-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salsify","download_url":"https://codeload.github.com/salsify/broccoli-underscore-template-compiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243293778,"owners_count":20268139,"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":["npm"],"created_at":"2024-11-18T12:07:33.710Z","updated_at":"2025-12-25T15:44:40.362Z","avatar_url":"https://github.com/salsify.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Broccoli Underscore Template Compiler\n\n## Installation\n\n```bash\nnpm install -D broccoli-underscore-template-compiler\n```\n\n## Example\n\n```javascript\nvar compileTemplates = require('broccoli-underscore-template-compiler');\n\nvar templatesTree = compileTemplates('templates', {\n  description: 'TemplateCompiler (appTemplates)'\n});\n```\n\n## Input Format\n\nGiven the following input:\n\n```html\n\u003ctemplate id=\"firstTemplate\" data-notes=\"This is my first template\"\u003e\n  \u003c%- message %\u003e\n\u003c/template\u003e\n```\n\nThis plugin will produce an ES6 module equivalent to:\n\n```javascript\nexport var firstTemplate = _.extend(_.template('\\n  \u003c%- message %\u003e\\n'), {\n  metadata: {\n    notes: 'This is my first template'\n  }\n});\n\nexport default {\n  firstTemplate: firstTemplate\n};\n```\n\nEach `\u003ctemplate\u003e` in the source file will be available as a field in the module's\ndefault export, as well as an exported variable of the same name, with any data\nattributes on the template available under a `metadata` hash hanging off of the\nresulting function.\n\n## Usage\n\nThe templates produced by this filter are just the output of Underscore's `_.template` function, so you can use them as [their documentation](http://underscorejs.org/#template) suggests:\n\n```js\nvar helloTemplate = _.template(\"hello: \u003c%= name %\u003e\");\nhelloTemplate({ name: 'moe' });\n//=\u003e \"hello: moe\"\n```\n\nThe exported template function is exposed from the compiled module, e.g.\n\n```html\n\u003c!-- templates/my-templates.html --\u003e\n\u003ctemplate id=\"helloTemplate\"\u003ehello: \u003c%= name %\u003e\u003c/template\u003e\n```\n\n```js\nimport { helloTemplate } from 'templates/my-templates';\nhelloTemplate({ name: 'moe' });\n//=\u003e \"hello: moe\"\n```\n\n## Configuration\n\n### `compileTemplates(inputTree, options)`\n\n---\n\n`options.extensions` *{Array}* (Optional, default `['html']`)\n\nThe file extensions which should be read and compiled as templates.\n\n## License\n\nThis project is distributed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalsify%2Fbroccoli-underscore-template-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalsify%2Fbroccoli-underscore-template-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalsify%2Fbroccoli-underscore-template-compiler/lists"}