{"id":13447290,"url":"https://github.com/wiledal/gulp-include","last_synced_at":"2025-10-11T14:09:37.274Z","repository":{"id":13267650,"uuid":"15953006","full_name":"wiledal/gulp-include","owner":"wiledal","description":"Enables functionality similar to that of snockets / sprockets or other file insertion compilation tools.","archived":false,"fork":false,"pushed_at":"2022-09-09T07:40:59.000Z","size":310,"stargazers_count":158,"open_issues_count":24,"forks_count":66,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-26T05:19:32.158Z","etag":null,"topics":["gulp","include","javascript"],"latest_commit_sha":null,"homepage":"","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/wiledal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2014-01-16T00:10:11.000Z","updated_at":"2025-07-14T06:03:20.000Z","dependencies_parsed_at":"2022-08-07T07:01:11.577Z","dependency_job_id":null,"html_url":"https://github.com/wiledal/gulp-include","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wiledal/gulp-include","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiledal%2Fgulp-include","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiledal%2Fgulp-include/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiledal%2Fgulp-include/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiledal%2Fgulp-include/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wiledal","download_url":"https://codeload.github.com/wiledal/gulp-include/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wiledal%2Fgulp-include/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003545,"owners_count":26083595,"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-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["gulp","include","javascript"],"created_at":"2024-07-31T05:01:13.051Z","updated_at":"2025-10-11T14:09:37.241Z","avatar_url":"https://github.com/wiledal.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# gulp-include [![NPM version][npm-image]][npm-url] ![Travis build][travis-image]\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003ePackage\u003c/td\u003e\u003ctd\u003egulp-include\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eDescription\u003c/td\u003e\n\u003ctd\u003eMakes inclusion of files a breeze. Enables functionality similar to that of snockets / sprockets or other file insertion compilation tools.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eNode Version\u003c/td\u003e\n\u003ctd\u003e\u003e= 6.0.0 \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eGulp Version\u003c/td\u003e\n\u003ctd\u003e\u003e= 3.0.0\u003c/td\u003e\n\u003c/table\u003e\n\n\u003e Works with gulp 3 and gulp 4\n\n## Features\n* Concatenate files with full control\n* Respects indentation whitespace\n* Uses [globs](https://www.npmjs.com/package/glob) for simple path control\n* Works recursively (files can include files that can include files, and so on)\n\n## Installation\n```shell\nnpm install gulp-include\n```\n## Usage\nExample `gulpfile.js`:\n```javascript\nconst gulp = require('gulp')\nconst include = require('gulp-include')\n\nexports.scripts = function (done) {\n  gulp.src('source/js/entry.js')\n    .pipe(include())\n      .on('error', console.log)\n    .pipe(gulp.dest('dist/js'))\n}\n\n```\n\n## Include directives\n`gulp-include` uses directives similar to `sprockets` or `snockets`. A _directive_ is a comment in your files that `gulp-include` recognizes as a command.\n\nExample directives:\n```javascript\n//=require vendor/jquery.js\n//=require vendor/**/*.js\n//=include relative/path/to/file.js\n//=include ./relative/path/to/file-even-when-includePaths-set.js\n```\n```css\n/*=include relative/path/to/file.css */\n```\n```coffee\n#=include relative/path/to/file.coffee\n```\n```html\n\u003c!--=include relative/path/to/file.html --\u003e\n```\n\nThe contents of the referenced file will replace the file.\n\n### `require` vs. `include`\nA file that is included with `require` will only be included if it has not been included  before. Files included with `include` will _always_ be included.  \nFor instance, let's say you want to include `jquery.js` only once, and before any of your other scripts in the same folder.\n```javascript\n//=require vendor/jquery.js\n//=require vendor/*.js\n```\nNote: This also works recursively. If for instance, for the example above, if another file in the folder `vendor` is also including `jquery.js` with the `require`-directive it will be ignored.\n\n## Options\n- `extensions` (optional)\n  * Takes a `String` or an `Array` of extensions.  \n  eg: `\"js\"` or `[\"js\", \"coffee\"]`\n  * If set, all directives that does not match the extension(s) will be ignored  \n\n\n- `includePaths` (optional)\n  * Takes a `String` or an `Array` of paths.  \n  eg: `__dirname + \"/node_modules\"` or `[__dirname + \"/assets/js\", __dirname + \"/bower_components\"]`\n  * If set, `gulp-include` will use these folders as base path when searching for files.\n  * If set, you can still include files relative to the current file by pre-pending includes with `./`.\n\n\n- `hardFail` (optional)\n  * Boolean, `false` by default\n  * Set this to `true` if you want `gulp-include` to throw errors if a file does not match\n  an include directive.\n  * If set to `false` gulp include will not fail, but display warnings in the console.\n  \n- `separateInputs` (optional)\n  * Boolean, `false` by default\n  * Set this to `true` to allow each input file to use `require`-directives independently.\n  * Useful if you are referencing several paths in `gulp.src` and need them to `require` the same files.\n\n#### Example options usage:\n```js\ngulp.src('src/js/main.js')\n  .pipe(include({\n    extensions: 'js',\n    hardFail: true,\n    separateInputs: true,\n    includePaths: [\n      __dirname + '/bower_components',\n      __dirname + '/src/js'\n    ]\n  }))\n  .pipe(gulp.dest('dist/js'))\n```\n\n## Changelog\nFor release notes see `CHANGELOG.md`.\n\n## Licence\n(MIT License)\n\nCopyright (c) 2014 Hugo Wiledal\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject 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,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n[travis-image]: https://api.travis-ci.org/wiledal/gulp-include.png?branch=master\n\n[npm-url]: https://npmjs.org/package/gulp-include\n[npm-image]: https://badge.fury.io/js/gulp-include.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiledal%2Fgulp-include","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwiledal%2Fgulp-include","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiledal%2Fgulp-include/lists"}