{"id":17188233,"url":"https://github.com/jclem/grunt-simple-templates","last_synced_at":"2025-03-25T04:39:48.028Z","repository":{"id":8608057,"uuid":"10247516","full_name":"jclem/grunt-simple-templates","owner":"jclem","description":null,"archived":false,"fork":false,"pushed_at":"2016-02-21T07:34:26.000Z","size":132,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T01:20:51.584Z","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/jclem.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":"2013-05-23T15:57:16.000Z","updated_at":"2013-11-06T16:44:10.000Z","dependencies_parsed_at":"2022-08-26T03:23:18.074Z","dependency_job_id":null,"html_url":"https://github.com/jclem/grunt-simple-templates","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/jclem%2Fgrunt-simple-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jclem%2Fgrunt-simple-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jclem%2Fgrunt-simple-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jclem%2Fgrunt-simple-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jclem","download_url":"https://codeload.github.com/jclem/grunt-simple-templates/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245401374,"owners_count":20609163,"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-15T01:08:27.791Z","updated_at":"2025-03-25T04:39:48.008Z","avatar_url":"https://github.com/jclem.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-simple-templates\n\n\u003e Simple compilation of JavaScript templates into objects\n\n## Getting Started\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-simple-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-simple-templates');\n```\n\n## The \"templates\" task\n\n### Overview\nIn your project's Gruntfile, add a section named `templates` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  templates: {\n    options: {\n      // Task-specific options go here.\n    },\n    your_target: {\n      // Target-specific file lists and/or options go here.\n    },\n  },\n})\n```\n\n### Options\n\n#### options.namespace\nType: `String`\nDefault value: `'TEMPLATES'`\n\nYour templates will be in an object called `window.#{NAMESPACE}`.\n\n#### options.extension\nType: `String`\nDefault value: `'mustache'`\n\nTemplates matching the extension `options.extension` will be compiled.\n\n### Usage Examples\n\n#### Default Options\nIn this example, the default options are used to compile Mustache templates. So if the `testing.mustache` file has the content `{{test}}` and the `dir/testing.mustache` file had the content `{{nested test}}`, the generated result would be `window.TEMPLATES = {\"testing\":\"{{test}}\\n\",\"dir/testing\":\"{{nested test}}\\n\"};`\n\n```js\ngrunt.initConfig({\n  templates: {\n    options: {},\n    files: {\n      src: 'templates/',\n      dest: 'js/templates.js'\n    },\n  },\n})\n```\n\n#### Custom Options\nIn this example, custom options are used to compile Handlebars templates. So if the `testing.hbs` file has the content `{{test}}` and the `dir/testing.hbs` file had the content `{{nested test}}`, the generated result in this case would be `window.HANDLEBARS = {\"testing\":\"{{test}}\\n\",\"dir/testing\":\"{{nested test}}\\n\"};`\n\n```js\ngrunt.initConfig({\n  templates: {\n    options: {\n      namespace: 'HANDLEBARS',\n      extension: 'hbs'\n    },\n    files: {\n      src: 'templates/',\n      dest: 'js/templtes.js'\n    },\n  },\n})\n```\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](http://gruntjs.com/).\n\n## Release History\n\n`0.0.2`: Only match provided or default extension.\n\n`0.0.1`: Initial release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjclem%2Fgrunt-simple-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjclem%2Fgrunt-simple-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjclem%2Fgrunt-simple-templates/lists"}