{"id":24834520,"url":"https://github.com/fiveladdercon/gulp-splice","last_synced_at":"2025-07-21T18:31:20.076Z","repository":{"id":57259039,"uuid":"50439542","full_name":"fiveladdercon/gulp-splice","owner":"fiveladdercon","description":"Splice one file into another in a gulp pipeline.","archived":false,"fork":false,"pushed_at":"2018-04-30T17:15:41.000Z","size":10,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T16:18:14.662Z","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/fiveladdercon.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":"2016-01-26T15:51:50.000Z","updated_at":"2018-04-30T17:15:42.000Z","dependencies_parsed_at":"2022-08-28T21:41:54.940Z","dependency_job_id":null,"html_url":"https://github.com/fiveladdercon/gulp-splice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fiveladdercon/gulp-splice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiveladdercon%2Fgulp-splice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiveladdercon%2Fgulp-splice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiveladdercon%2Fgulp-splice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiveladdercon%2Fgulp-splice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fiveladdercon","download_url":"https://codeload.github.com/fiveladdercon/gulp-splice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiveladdercon%2Fgulp-splice/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266352508,"owners_count":23915766,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-01-31T03:29:05.555Z","updated_at":"2025-07-21T18:31:20.055Z","avatar_url":"https://github.com/fiveladdercon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-splice\n\nSplices one file into another in a gulp pipeline.\n\n## Install\n\n```\n\u003e npm install gulp-splice\n```\n\n## Usage\n\nThe **inner** file is spliced into the **outer** file by replacing the first occurancy of the **key** in the outer file\nwith the contents of the inner file:\n\n```\nouter.txt\n\nThis is outer file content.\n\u003c#key#\u003e\nThis is outer file content.\n```\n\n```\ninner.txt\n\nThis is inner file content.\n```\n\n```javascript\nvar splice = require('gulp-splice');\n\ngulp.src(['inner.txt','outer.txt']).pipe(splice('\u003c#key#\u003e'))\n```\n\n```\nouter.txt\n\nThis is outer file content.\nThis is inner file content.\nThis is outer file content.\n```\n\nIn the above, both files entered through the pipe.  But you can also specify inner\nor outer files that do not enter through the pipe:\n\n```javascript\ngulp.src('outer.txt').pipe(splice({key:'\u003c#key#\u003e', inner:'inner.txt'}))\n\ngulp.src('inner.txt').pipe(splice({key:'\u003c#key#\u003e', outer:'outer.txt'}))\n\ngulp.src().pipe(splice({key:'\u003c#key#\u003e', inner:'inner.txt', outer:'outer.txt' }))\n```\n\nAnd all three produce the same result as the original:\n\n```\nouter.txt\n\nThis is outer file content.\nThis is inner file content.\nThis is outer file content.\n```\n\nYou can also send more than two files in through the pipe:\n\n```javascript\ngulp.src('*.txt').pipe(splice('\u003c#key#\u003e'))\n```\n\nIn the absence of inner and outer options all *non-outer files are concatinated* to form \na single inner file and spliced into the outer file, which is the first file that contains\nthe key:\n\n```\nouter.txt\n\nThis is outer file content.\nThis is non-outer file 1 content.\nThis is non-outer file 2 content.\nThis is non-outer file 3 content.\n...\nThis is outer file content.\n```\n\nAdding an inner option disables the concatination of non-outer files, and all other files\nnot involved in the splice are passed through:\n\n```javascript\ngulp.src('*.txt').pipe(splice({key: '\u003c#key#\u003e', inner:'file1.txt'))\n```\n\n```\nouter.txt\n\nThis is outer file content.\nThis is file 1 content.\nThis is outer file content.\n```\n```\nfile2.txt\n\n...\n```\n```\nfile3.txt\n\n...\n```\n```\n...\n```\n\n## API\n\n```javascript\nsplice('key') \nsplice(options)\n```\n\n#### options.key : string\n\nThe key is a string that identifies the insertion point in the outer file.  Only the first \noccurance in the outer file is replaced with the contents of the inner file.\n\n#### options.outer : string\n\nIf the outer option is present, the outer file is the file specified by the option.  If the file\narrives down the pipe it is plucked from the file stream, otherwise it is opened from the file\nsystem.  If the outer option is absent, the outer file is the first file arriving down the pipe\nthat contains the key.\n\n#### options.inner : string\n\nIf the inner option is present, the inner file is the file specified by the option.  If the file\narrives down the pipe it is plucked from the file stream, otherwise it is opened from the file\nsystem.  If the inner option is absent, all non-outer files ariving down the pipe are concatinated\nto form the inner file.\n\n\n\n## Example\n\nHere's an example that inlines HTML view templates into the bottom of the index.html:\n\n```\nindex.html\n\n\u003chtml\u003e\n\u003cbody\u003e\n\u003ch1\u003eMain\u003c/h1\u003e\n##views##\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n```\npartial-A.html\n\n\u003ch1\u003eView A\u003c/h1\u003e\n```\n\n```\npartial-B.html\n\n\u003ch1\u003eView B\u003c/h1\u003e\n```\n\n```\npartial-C.html\n\n\u003ch1\u003eView C\u003c/h1\u003e\n```\n\n```javascript\ngulp.src('*.html')\n\t.pipe(htmlmin())\n\t.pipe(splice('##views##'))\n\t.dest('dist/')\n```\n\n```\ndist/index.html\n\n\u003chtml\u003e\u003cbody\u003e\u003ch1\u003eMain\u003c/h1\u003e\u003ch1\u003eView A\u003c/h1\u003e\u003ch1\u003eView B\u003c/h1\u003e\u003ch1\u003eView C\u003c/h1\u003e\u003c/body\u003e\u003c/html\u003e\n```\n\n### Test\n\n```\n\u003e npm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiveladdercon%2Fgulp-splice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffiveladdercon%2Fgulp-splice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiveladdercon%2Fgulp-splice/lists"}