{"id":19806623,"url":"https://github.com/timnew/gulp-tree-concat","last_synced_at":"2025-05-01T07:31:01.799Z","repository":{"id":18544594,"uuid":"21745716","full_name":"timnew/gulp-tree-concat","owner":"timnew","description":"A Gulp processor to merge multiple javascript files into one with hierarchy","archived":false,"fork":false,"pushed_at":"2015-04-10T14:18:42.000Z","size":158,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T07:48:17.714Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"CoffeeScript","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/timnew.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-07-11T17:48:50.000Z","updated_at":"2018-02-01T11:21:45.000Z","dependencies_parsed_at":"2022-09-02T04:02:03.727Z","dependency_job_id":null,"html_url":"https://github.com/timnew/gulp-tree-concat","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/timnew%2Fgulp-tree-concat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Fgulp-tree-concat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Fgulp-tree-concat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Fgulp-tree-concat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timnew","download_url":"https://codeload.github.com/timnew/gulp-tree-concat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251840163,"owners_count":21652292,"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-11-12T09:08:01.549Z","updated_at":"2025-05-01T07:31:01.587Z","avatar_url":"https://github.com/timnew.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"gulp-tree-concat [![NPM version][npm-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Dependency Status][depstat-image]][depstat-url]\n================\n\n\u003e A [Gulp](http://gulpjs.com/) processor to merge multiple javascript files into one with hierarchy\n\n## Install\n\nInstall using [npm][npm-url].\n\n    $ npm install gulp-tree-concat\n\n## Usage\n\n```javascript\nvar jade = require('gulp-jade')\n  , treeConcat = require('gulp-tree-concat')\n\ngulp.task('template', function () {\n  gulp.src('client/templates/**/*.jade')\n    .pipe(jade({client:true, compileDebug: false}}))    \n    .pipe(treeConcat({\n      output: 'template.js',\n      namespace: 'Views.JadeTemplates',\n      hierarchy: true,\n      pathTemplate: treeConcat.nameTemplates.relative('client/templates/')\n    })\n    .pipe(gulp.dest('public/assets'));\n});\n```\n\nThis compiles all of your jade template into a single file `template.js` as precompiled template,\ndefining `Views.JadeTemplates = { /* template fns */ }`.\n\nLet's say we have views located at\n- `client/app/views/item.jade` \n- `client/app/views/admin/user.jade`\n\nGiven the example's option as described before, those views\nwill now be accessible as precompiled [jade](http://jade-lang.com/) precompiled client template functions via\n\n- `Views.JadeTemplates.item`\n- `Views.JadeTemplates.admin.user`\n\n(Please note that `gulp-tree-concat` only take cares to concat the compiled template, the jade template compiling is done by `gulp-jade`. And `gulp-tree-concat` doesn't have to be used in conjunction with `gulp-jade`. Any javascript files will do.)\n\n### Sample Output\n\n** TODO **\n\n## Options\n\n### output\nType `String`\n\u003e The output file name\n\n### namespace\nType `String`, default to `this.Templates`\n\u003e The object that holds the concated templates\n\u003e `gulp-tree-concat` respects your namespace, it appends new members to the namespace one by one instead of override the whole object with `=`. So multiple output file can be loaded without conflict.\n\n### hierarchy\nType `Boolean`, default to `false`\n\u003e Indicate whether the hierarchy should be built.\n\u003e If `hierarchy` is set to `false` in the sample, the template `client/app/views/admin/user.jade` will be stored as `Views.JadeTemplates['admin/user']`.\n\n### nameDivider\nType `String`, default to `/`\n\u003e The name divider to parse the hierarchy from the name of the template.\n\u003e Could change to `.` to build hierarchy from filename. \n\u003e Since the value is used in `RegExp`, please escape it when necessary.\n\u003e Will be ignored if `hierarchy` is set to `false`\n\n### pathTemplate\nType `function(File)`, `(File) -\u003e node name` Mapping, default to `treeConcat.path.none`\n\u003e The function to build the name for a file, usually the name is exctract from file name. But also could be extract from `contents` if necessary\n\nSeveral predefined builder are included:\n\n### `treeConcat.nameTemplates.fullpath()`\n\n\u003e Extract the file full path as template name\n\u003e `/folder/file.js` will be mapped to `/folder/file.js`\n\n#### `treeConcat.nameTemplates.filename(removeExtension = true)`\n\n\u003e Extract the file name as template name, extension name can be removed\n\u003e `/folder/file.js` will be mapped to `file`\n\n**Parameters**\n\n* **removeExtension**  controls how the extension is removed\n  * **true** the extensions are removed\n  * **false** the exensions are reserved\n  * **'.js'** only the extensions matched are removed\n\n#### `treeConcat.nameTemplates.relative(baseFolder, removeExtension = true)`\n\n\u003e Extract the the relative path based on `basedFolder`, extension name can be removed\n\u003e `/folder/subfolder/file.js` will be mapped to `subfolder/file`\n\n**Parameters**\n\n* **baseFolder** the relative path that you want to remove from name\n\n* **removeExtension**  controls how the extension is removed\n  * **true** the extensions are removed\n  * **false** the exensions are reserved\n  * **'.js'** only the extensions matched are removed\n\n\n## License\nMIT\n\n[![NPM downloads][npm-downloads]][npm-url]\n\n[npm-url]: https://npmjs.org/package/gulp-tree-concat\n[npm-image]: http://img.shields.io/npm/v/gulp-tree-concat.svg?style=flat\n[npm-downloads]: http://img.shields.io/npm/dm/gulp-tree-concat.svg?style=flat\n\n[ci-url]: https://drone.io/github.com/timnew/gulp-tree-concat/latest\n[ci-image]: https://drone.io/github.com/timnew/gulp-tree-concat/status.png\n\n[depstat-url]: https://gemnasium.com/timnew/gulp-tree-concat\n[depstat-image]: http://img.shields.io/gemnasium/timnew/gulp-tree-concat.svg?style=flat\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimnew%2Fgulp-tree-concat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimnew%2Fgulp-tree-concat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimnew%2Fgulp-tree-concat/lists"}