{"id":15698962,"url":"https://github.com/doowb/gulp-permalinks","last_synced_at":"2025-05-09T02:14:46.980Z","repository":{"id":57258463,"uuid":"82098002","full_name":"doowb/gulp-permalinks","owner":"doowb","description":"Gulp plugin for easily creating permalinks for vinyl files.","archived":false,"fork":false,"pushed_at":"2017-02-16T21:59:13.000Z","size":17,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-09T02:14:39.637Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/doowb/gulp-permalinks","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/doowb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-15T19:28:25.000Z","updated_at":"2021-04-12T21:59:55.000Z","dependencies_parsed_at":"2022-08-25T21:23:45.427Z","dependency_job_id":null,"html_url":"https://github.com/doowb/gulp-permalinks","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgulp-permalinks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgulp-permalinks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgulp-permalinks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgulp-permalinks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/gulp-permalinks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253176444,"owners_count":21866143,"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-03T19:36:49.445Z","updated_at":"2025-05-09T02:14:46.960Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-permalinks [![NPM version](https://img.shields.io/npm/v/gulp-permalinks.svg?style=flat)](https://www.npmjs.com/package/gulp-permalinks) [![NPM monthly downloads](https://img.shields.io/npm/dm/gulp-permalinks.svg?style=flat)](https://npmjs.org/package/gulp-permalinks)  [![NPM total downloads](https://img.shields.io/npm/dt/gulp-permalinks.svg?style=flat)](https://npmjs.org/package/gulp-permalinks) [![Linux Build Status](https://img.shields.io/travis/doowb/gulp-permalinks.svg?style=flat\u0026label=Travis)](https://travis-ci.org/doowb/gulp-permalinks) [![Windows Build Status](https://img.shields.io/appveyor/ci/doowb/gulp-permalinks.svg?style=flat\u0026label=AppVeyor)](https://ci.appveyor.com/project/doowb/gulp-permalinks)\n\n\u003e Gulp plugin for easily creating permalinks for vinyl files.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save gulp-permalinks\n```\n\n## Usage\n\n```js\nvar permalinks = require('gulp-permalinks');\n```\n\n## API\n\n**Params**\n\n* `structure` **{String}**: permalink structure to use for each file. See [permalinks](https://github.com/jonschlinkert/permalinks) for more details.\n* `options` **{Object}**: Additional options to pass to [permalinks](https://github.com/jonschlinkert/permalinks) and to control how files are handled in the stream.\n* `options.flush` **{Boolean}**: When set to `true` the files will be pushed back onto the stream in the \"flush\" function to ensure that all files are updated before continuing. Defaults to `false`.\n* `options.update` **{Boolean}**: When set to `false` the files' path property will not be updated with the new permalink. Defaults to `true`.\n* `options.permalinks` **{Object}**: Optionally pass your own instance of [permalinks](https://github.com/jonschlinkert/permalinks).\n* `fn` **{Function}**: Optional function that will be passed the `file` as it comes through the stream. This allows a user to set custom properties on `file.data` to be available in the `structure`.\n* `returns` **{Stream}**: Stream that can be used in a [gulp](http://gulpjs.com) pipeline.\n\n**Example**\n\n```js\ngulp.task('permalinks', function() {\n  return gulp.src('path/to/posts/*.md')\n    .pipe(permalinks('blog/:stem/index.html'))\n    .pipe(gulp.dest('_gh_pages'));\n});\n```\n\n## Examples\n\n**Default file properties**\n\nThis example uses somes of the default file properties calculated from the `file.path`.\n\n```js\ngulp.task('permalinks', function() {\n  return gulp.src('path/to/posts/*.md')\n    .pipe(permalinks('blog/:stem/index.html'))\n    .pipe(gulp.dest('_gh_pages'));\n});\n\n// writes to '_gh_pages/blog/my-file-stem/index.html'\n```\n\n**Custom helpers**\n\nThis example registers some custom helpers by passing them into the plugin through the options object.\n\n```js\ngulp.task('permalinks', function() {\n  var options = {\n    helpers: {\n      foo: function() {\n        return this.context.stem.toUpperCase();\n      },\n      date: function() {\n        return moment().format('YYYY/MM/DD');\n      }\n    }\n  }\n\n  return gulp.src('path/to/posts/*.md')\n    .pipe(permalinks('blog/:date/:foo.html', options))\n    .pipe(gulp.dest('_gh_pages'));\n});\n\n// writes to '_gh_pages/blog/2017/02/15/MY-FILE-STEM.html'\n```\n\n**Custom presets**\n\nThis example registers some custom presets by passing them into the plugin through the options object.\n\n```js\ngulp.task('permalinks', function() {\n  var options = {\n    presets: {\n      blog: 'blog/:stem/index.html'\n    }\n  };\n\n  return gulp.src('path/to/posts/*.md')\n    .pipe(permalinks('blog', options))\n    .pipe(gulp.dest('_gh_pages'));\n});\n\n// writes to '_gh_pages/blog/my-file-stem/index.html'\n```\n\n**Custom data**\n\nThis example registers some custom data by passing it into the plugin through the options object.\n\n```js\ngulp.task('permalinks', function() {\n  var options = {\n    data: {\n      foo: 'bar',\n      baz: 'qux'\n    }\n  };\n\n  return gulp.src('path/to/posts/*.md')\n    .pipe(permalinks('blog/:foo/:baz/:stem/index.html', options))\n    .pipe(gulp.dest('_gh_pages'));\n});\n\n// writes to '_gh_pages/blog/bar/qux/my-file-stem/index.html'\n```\n\n## About\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\nPlease read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](https://twitter.com/doowb)\n\n### License\n\nCopyright © 2017, [Brian Woodward](https://github.com/doowb).\nMIT\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 16, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgulp-permalinks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fgulp-permalinks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgulp-permalinks/lists"}