{"id":19837400,"url":"https://github.com/mdvanes/grunt-kot2html","last_synced_at":"2026-04-11T22:52:46.651Z","repository":{"id":29251048,"uuid":"32783386","full_name":"mdvanes/grunt-kot2html","owner":"mdvanes","description":"Grunt task to combine Knockout templates into one HTML for the Knockout.js-External-Template-Engine.","archived":false,"fork":false,"pushed_at":"2022-09-20T06:32:53.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T07:13:32.002Z","etag":null,"topics":["grunt-task"],"latest_commit_sha":null,"homepage":"","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/mdvanes.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":"2015-03-24T07:49:12.000Z","updated_at":"2022-09-20T06:32:55.000Z","dependencies_parsed_at":"2022-09-04T14:51:41.773Z","dependency_job_id":null,"html_url":"https://github.com/mdvanes/grunt-kot2html","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/mdvanes%2Fgrunt-kot2html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdvanes%2Fgrunt-kot2html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdvanes%2Fgrunt-kot2html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdvanes%2Fgrunt-kot2html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdvanes","download_url":"https://codeload.github.com/mdvanes/grunt-kot2html/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241202463,"owners_count":19926613,"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":["grunt-task"],"created_at":"2024-11-12T12:14:19.985Z","updated_at":"2026-04-11T22:52:46.622Z","avatar_url":"https://github.com/mdvanes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build Status](https://travis-ci.org/mdvanes/grunt-kot2html.svg?branch=master) [![npm version](https://badge.fury.io/js/grunt-kot2html.svg)](https://badge.fury.io/js/grunt-kot2html)\n\n# grunt-kot2html\n\n\u003e Grunt task to combine Knockout templates into one HTML for the Knockout.js-External-Template-Engine.\n\nBased on https://blog.safaribooksonline.com/2014/01/31/using-external-templates-knockout-js/ and https://github.com/rniemeyer/SamplePresentation/blob/master/js/stringTemplateEngine.js\n\nSee also [grunt-kot2js](https://github.com/mdvanes/grunt-kot2js).\n\n## Getting Started\nThis plugin requires Grunt `~0.4.5`\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-kot2html --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-kot2html');\n```\n\nAlthough I recommend using [load-grunt-tasks](https://www.npmjs.com/package/load-grunt-tasks)\n\n## The \"kot2html\" task\n\n### Overview\nIn your project's Gruntfile, add a section named `kot2html` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n    kot2html: {\n        dist: {\n            prefix: '/theme/',\n            src: 'templates/**/*.html',\n            dest: 'custom-templates.html'\n        }\n    }\n});\n```\n\nExample output:\n\n```html\n\u003cscript type=\"text/html\" id=\"/theme/templates/TemplateA\"\u003e\n    \u003cspan class=\"a\" data-bind=\"text: foo\"\u003e\u003c/span\u003e\n\u003c/script\u003e\n\u003cscript type=\"text/html\" id=\"/theme/templates/TemplateB\"\u003e\n    \u003cspan class=\"a\" data-bind=\"text: bar\"\u003e\u003c/span\u003e\n\u003c/script\u003e\n```\n\n### Properties\n\n#### prefix\nType: `String`\n\nPrefix that is prepended to the template id along with the path. E.g. if the prefix is `/theme/` and the path of a template is `templates/bar.html`, the templateId will be `/theme/template/bar` (without .html).\n\n#### srcRoot\nType: `String`\n\nRoot of the input path. This part is not included in the template ID, in contrast to the `src` property.\n\n#### src\nType: `String`\n\nInput path. Location of the HTML Knockout Templates. Expects template files to have the .html extension\n\n#### dest\nType: `String`\n\nOutput path. Location of the combined HTML file.\n\n### Usage Examples\n\n#### Default Options\nIn this example, the sources are files with the .html extension in the `templates` dir and the generated file is `custom-templates.html` in the root dir.\n\n```js\ngrunt.initConfig({\n    kot2html: {\n        dist: {\n            prefix: '/theme/',\n            src: 'templates/**/*.html',\n            dest: 'custom-templates.html'\n        }\n    }\n});\n```\n\n## Contributing\nFollow the jshintrc settings for the code style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n\n## Release History\n\n* 2015-03-25    v0.1.0     initial release\n* 2016-02-25    v0.3.0     added srcRoot property\n\n## To Do\n\n* When committing got: warning: LF will be replaced by CRLF in test/expected/dev. This means that the unit test will fail.\n* Add lintspaces\n* add minification of generated HTML (at least remove all spaces)\n* add template to unit test with same path as generated HTML","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdvanes%2Fgrunt-kot2html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdvanes%2Fgrunt-kot2html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdvanes%2Fgrunt-kot2html/lists"}