{"id":16185217,"url":"https://github.com/davemo/grunt-batman-templates","last_synced_at":"2025-04-07T13:13:21.766Z","repository":{"id":10883533,"uuid":"13173361","full_name":"davemo/grunt-batman-templates","owner":"davemo","description":"Generates and stores BatmanJS templates in the Batman HTMLStore","archived":false,"fork":false,"pushed_at":"2021-11-20T01:13:34.000Z","size":12,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-04T12:07:56.575Z","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/davemo.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-09-28T13:27:13.000Z","updated_at":"2014-08-15T20:29:44.000Z","dependencies_parsed_at":"2022-08-29T19:30:27.944Z","dependency_job_id":null,"html_url":"https://github.com/davemo/grunt-batman-templates","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemo%2Fgrunt-batman-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemo%2Fgrunt-batman-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemo%2Fgrunt-batman-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemo%2Fgrunt-batman-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davemo","download_url":"https://codeload.github.com/davemo/grunt-batman-templates/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657271,"owners_count":20974345,"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-10T07:13:48.342Z","updated_at":"2025-04-07T13:13:21.750Z","avatar_url":"https://github.com/davemo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"grunt-batman-templates\n======================\n\n[![Build Status](https://travis-ci.org/davemo/grunt-batman-templates.png?branch=master)](https://travis-ci.org/davemo/grunt-batman-templates)\n\n\u003e Generates precache commands for Batman templates to pre-populate `Batman.View.store`\n\nGetting Started\n------------------\n\nThis plugin requires Grunt `~0.4.1`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-batman-templates --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-batman-templates');\n```\n\nThe \"batman_templates\" task\n---------------------------\n\n### Overview\nIn your project's Gruntfile, add a section named `batman_templates` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  batman_templates: {\n    options: {\n      templateFolder: 'app/html' // optional, defaults to 'app/html'\n    },\n    files: {\n      src: 'app/html/**/*.html'\n      dest: 'batman-view-precache.js'\n    }\n  }\n});\n```\n\nSample Output\n---------------------------\n\nThe following shows what the resulting `batman-view-precache.js` file looks like, based on the unit tests:\n\n```js\nBatman.View.store.set('posts/index', '\u003ch1\u003eWelcome to the Posts Page\u003c/h1\u003e\\n\u003cul class=\\\"posts\\\"\u003e\\n  \u003cli class=\\\"post\\\" data-foreach-post=\\\"posts\\\"\u003e\\n    \u003cspan class=\\\"title\\\" data-bind=\\\"post.title\\\"\u003e\u003c/span\u003e\\n    \u003cspan class=\\\"created-at\\\" data-bind=\\\"post.created_at\\\"\u003e\u003c/span\u003e\\n  \u003c/li\u003e\\n\u003c/ul\u003e\\n');\nBatman.View.store.set('posts/show', '\u003ch1\u003ePost: \u003cspan data-bind=\\\"post.title\\\"\u003e\u003c/span\u003e\u003c/h1\u003e\\n\u003cspan class=\\\"created-at\\\" data-bind=\\\"post.created_at\\\"\u003e\u003c/span\u003e\\n\u003cdiv data-bind=\\\"post.content\\\"\u003e\u003c/div\u003e\\n');\nBatman.View.store.set('posts/subfolder/subtemplate', '\u003ch1\u003eThis is a special template\u003c/h1\u003e\\n\u003cdiv\u003eVerifies that subfolder path lookups in the task work\u003c/div\u003e\\n');\nBatman.View.store.set('products/index', '\u003ch1\u003eWelcome to the Posts Page\u003c/h1\u003e\\n\u003cul class=\\\"products\\\"\u003e\\n  \u003cli class=\\\"product\\\" data-foreach-product=\\\"products\\\"\u003e\\n    \u003cspan class=\\\"name\\\" data-bind=\\\"product.name\\\"\u003e\u003c/span\u003e\\n    \u003cspan class=\\\"price\\\" data-bind=\\\"product.price\\\"\u003e\u003c/span\u003e\\n  \u003c/li\u003e\\n\u003c/ul\u003e\\n');\n```\n\nYou would include this JavaScript file _after_ your Batman application code ie:\n\n```html\n\u003cscript src=\"/path/to/batman.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"/path/to/my-batman-app.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"/path/to/batman-view-precache.js\"\u003e\u003c/script\u003e\n```\n\nContributing\n------------\n\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](http://gruntjs.com/).\n\nLicense\n------------\n\ngrunt-batman-templates was created by [David Mosher](http://www.github.com/davemo), and is distributed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavemo%2Fgrunt-batman-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavemo%2Fgrunt-batman-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavemo%2Fgrunt-batman-templates/lists"}