{"id":14973158,"url":"https://github.com/miickel/gulp-angular-templatecache","last_synced_at":"2025-05-15T11:07:57.736Z","repository":{"id":12978300,"uuid":"15656979","full_name":"miickel/gulp-angular-templatecache","owner":"miickel","description":"Concatenates and registers AngularJS templates in the $templateCache.","archived":false,"fork":false,"pushed_at":"2022-02-17T14:01:50.000Z","size":163,"stargazers_count":525,"open_issues_count":6,"forks_count":104,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-12T01:05:18.785Z","etag":null,"topics":["angularjs","gulp","gulp-plugin","javascript","templatecache"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"chaselgrove/xnat-docker","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miickel.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-01-05T19:10:08.000Z","updated_at":"2024-10-21T16:57:40.000Z","dependencies_parsed_at":"2022-09-18T23:00:50.750Z","dependency_job_id":null,"html_url":"https://github.com/miickel/gulp-angular-templatecache","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miickel%2Fgulp-angular-templatecache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miickel%2Fgulp-angular-templatecache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miickel%2Fgulp-angular-templatecache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miickel%2Fgulp-angular-templatecache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miickel","download_url":"https://codeload.github.com/miickel/gulp-angular-templatecache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254328384,"owners_count":22052632,"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":["angularjs","gulp","gulp-plugin","javascript","templatecache"],"created_at":"2024-09-24T13:48:14.468Z","updated_at":"2025-05-15T11:07:57.716Z","avatar_url":"https://github.com/miickel.png","language":"JavaScript","readme":"# gulp-angular-templatecache\n\n## The [npm package](https://www.npmjs.com/package/gulp-angular-templatecache) related to this repo was deprecated after v3.0.1 was published on 02/17/22. Ownership has been responsibly transferred to npm.\n\n---\n\n[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://npmjs.org/package/gulp-angular-templatecache)\n[![NPM version](http://img.shields.io/npm/v/gulp-angular-templatecache.svg?style=flat)](https://npmjs.org/package/gulp-angular-templatecache)\n[![NPM version](http://img.shields.io/npm/dm/gulp-angular-templatecache.svg?style=flat)](https://npmjs.org/package/gulp-angular-templatecache)\n[![Build Status](http://img.shields.io/travis/miickel/gulp-angular-templatecache.svg?style=flat)](http://travis-ci.org/miickel/gulp-angular-templatecache)\n[![Dependency Status](http://img.shields.io/gemnasium/miickel/gulp-angular-templatecache.svg?style=flat)](https://gemnasium.com/miickel/gulp-angular-templatecache)\n\n\u003e Concatenates and registers AngularJS templates in the `$templateCache`.\n\n\u003ca href=\"#install\"\u003eInstall\u003c/a\u003e |\n\u003ca href=\"#example\"\u003eExample\u003c/a\u003e |\n\u003ca href=\"#api\"\u003eAPI\u003c/a\u003e |\n[Releases](https://github.com/miickel/gulp-angular-templatecache/releases) |\n\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\n\n----\n\n\n## Install\n\nInstall with [npm](https://npmjs.org/package/gulp-angular-templatecache)\n\n```\nnpm install gulp-angular-templatecache --save-dev\n```\n\n\n## Example\n\n**gulpfile.js**\n\n\u003e Concatenate the contents of all .html-files in the templates directory and save to _public/templates.js_ (default filename).\n\n```js\nvar templateCache = require('gulp-angular-templatecache');\n\ngulp.task('default', function () {\n  return gulp.src('templates/**/*.html')\n    .pipe(templateCache())\n    .pipe(gulp.dest('public'));\n});\n```\n\n**Result (_public/templates.js_)**\n\n\u003e Sample output (prettified).\n\n```js\nangular.module(\"templates\").run([$templateCache,\n  function($templateCache) {\n    $templateCache.put(\"template1.html\",\n      // template1.html content (escaped)\n    );\n    $templateCache.put(\"template2.html\",\n      // template2.html content (escaped)\n    );\n    // etc.\n  }\n]);\n\n```\n\nInclude this file in your app and AngularJS will use the $templateCache when available.\n\n__Note:__ this plugin will __not__ create a new AngularJS module by default, but use a module called `templates`. If you would like to create a new module, set [options.standalone](https://github.com/miickel/gulp-angular-templatecache#standalone---boolean-standalonefalse) to `true`.\n\n__Note:__ if you use Visual Studio on Windows, you might encounter this error message: `ASPNETCOMPILER : error ASPRUNTIME: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.`\n\nThis is most likely due to long path names, and can be fixed by adding `lodash.bind` as a dev dependecy in your package.json. Anyway, if you encounter this error, please drop a note in #62, and we might merge #63.\n\n\n## API\n\ngulp-angular-templatecache([filename](https://github.com/miickel/gulp-angular-templatecache#filename---string-filenametemplatesjs), [options](https://github.com/miickel/gulp-angular-templatecache#options))\n\n---- \n\n### filename - {string} [filename='templates.js']\n\n\u003e Name to use when concatenating.\n\n### options\n\n#### root - {string}\n\n\u003e Prefix for template URLs.\n\n#### module - {string} [module='templates']\n\n\u003e Name of AngularJS module.\n\n#### standalone - {boolean} [standalone=false]\n\n\u003e Create a new AngularJS module, instead of using an existing.\n\n#### base {string | function} [base=file.base]\n\n\u003e Override file base path.\n\n#### moduleSystem {string}\n\n\u003e Wrap the templateCache in a module system. Currently supported systems: `RequireJS`, `Browserify`, `ES6` and `IIFE` (Immediately-Invoked Function Expression).\n\n#### transformUrl {function}\n\n\u003e Transform the generated URL before it's put into `$templateCache`.\n\n```js\ntransformUrl: function(url) {\n\treturn url.replace(/\\.tpl\\.html$/, '.html')\n}\n```\n\n#### templateHeader {string} [templateHeader=see below]\n\n\u003e Override template header.\n\n```js\nvar TEMPLATE_HEADER = 'angular.module(\"\u003c%= module %\u003e\"\u003c%= standalone %\u003e).run([\"$templateCache\", function($templateCache) {';\n```\n\n#### templateBody {string} [templateBody=see below]\n\n\u003e Override template body.\n\n```js\nvar TEMPLATE_BODY = '$templateCache.put(\"\u003c%= url %\u003e\",\"\u003c%= contents %\u003e\");';\n```\n\n#### templateFooter {string} [templateFooter=see below]\n\n\u003e Override template footer.\n\n```js\nvar TEMPLATE_FOOTER = '}]);';\n```\n\n#### escapeOptions - {object}\n\n\u003e Options for jsesc module. See [jsesc API](https://www.npmjs.com/package/jsesc#api)\n\n\n## Changes\n\n\u003e This plugin uses Semantic Versioning 2.0.0\n\n### 1.1.0 and newer\n\nSee [Releases](https://github.com/miickel/gulp-angular-templatecache/releases)\n\n### 1.0.0\n\n\u003e Cleaner code, more tests and improved documentation. Thoroughly used in development.\n\n- adds\n  - `options.standalone` (**breaking**)\n- fixes\n  - Windows support\n- changes\n  - `filename` now optional\n\n### 0.3.0\n\n- adds\n  - `options.module`\n\n### 0.2.0 and earlier\n\n\u003e Only used by mad men\n\n![](http://media3.giphy.com/media/bAplZhiLAsNnG/giphy.gif)\n\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 [Mickel](http://mickel.me)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[![Analytics](https://ga-beacon.appspot.com/UA-46880034-1/gulp-angular-templatecache/readme?pixel)](https://github.com/igrigorik/ga-beacon)\n","funding_links":[],"categories":["插件","Plugins"],"sub_categories":["模板","Templating"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiickel%2Fgulp-angular-templatecache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiickel%2Fgulp-angular-templatecache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiickel%2Fgulp-angular-templatecache/lists"}