# gulp-symlink

> Create symlinks during your gulp build.

Latest version **2.1.4** (published 2016-01-30) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install gulp-symlink
pnpm add gulp-symlink
yarn add gulp-symlink
bun add gulp-symlink
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1.4 |
| Published | 2016-01-30 |
| First published | 2014-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 37 |
| Author | Ben Briggs |
| Maintainers | beneb |
| Keywords | gulpplugin, symlink |

## Links

- npm: https://www.npmjs.com/package/gulp-symlink
- Repository: https://github.com/ben-eb/gulp-symlink
- Issues: https://github.com/ben-eb/gulp-symlink/issues
- npm.io page: https://npm.io/package/gulp-symlink

## Dependencies (4)

- [async](https://npm.io/package/async.md) ~1.4.0
- [mkdirp](https://npm.io/package/mkdirp.md) ~0.5.1
- [through2](https://npm.io/package/through2.md) ~2.0.0
- [gulp-util](https://npm.io/package/gulp-util.md) ~3.0.6

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 2.1.4 (latest) — 2016-01-30
- 2.1.3 — 2015-09-29
- 2.1.2 — 2015-07-27
- 2.1.1 — 2015-06-24
- 2.1.0 — 2014-11-23
- 2.0.1 — 2014-10-24
- 2.0.0 — 2014-10-20
- 1.1.0 — 2014-06-04
- 1.0.3 — 2014-05-03
- 1.0.2 — 2014-04-23
- 1.0.1 — 2014-04-20
- 1.0.0 — 2014-04-20
- 0.4.2 — 2014-04-04
- 0.4.1 — 2014-02-27
- 0.4.0 — 2014-02-22
- … 12 more at https://npm.io/package/gulp-symlink/versions

## README

# Deprecation Notice

gulp 4 adds built-in symlinks to the public API, making it really easy to
create streams of symlinks. Therefore, this module has been deprecated.

You may replace this module with a call to [vinyl-fs][vfs] for gulp 3.x:

```js
var vfs = require('vinyl-fs');

gulp.task('symlink', function () {
  return vfs.src('assets/some-large-video.mp4', {followSymlinks: false})
  .pipe(vfs.symlink('build/videos'));
});
```

[vfs]: https://github.com/gulpjs/vinyl-fs

# [gulp](https://github.com/gulpjs/gulp)-symlink

> Create symlinks during your gulp build.

## Install

With [npm](https://npmjs.org/package/gulp-symlink) do:

```
npm install gulp-symlink --save-dev
```

## Example

```js
var symlink = require('gulp-symlink');

gulp.task('default', function () {
  return gulp.src('assets/some-large-video.mp4')
    .pipe(symlink('build/videos')) // Write to the destination folder
    .pipe(symlink('build/videos/renamed-video.mp4')) // Write a renamed symlink to the destination folder
});
```

## API

### symlink(path, [options]), symlink.relative(path, [options]) or symlink.absolute(path, [options])

Pass a `string` or a `function` to create the symlink.
The function is passed the [vinyl](https://github.com/wearefractal/vinyl) object, so you can use `file.base`, `file.path` etc.
For example:

```js
gulp.task('symlink', function () {
  return gulp.src('assets/some-large-video.mp4')
    .pipe(symlink(function (file) {
      // Here we return a path as string
      return path.join(file.base, 'build', file.relative.replace('some-large', ''));
    }));
});

gulp.task('symlink-vinyl', function () {
  return gulp.src('assets/some-large-video.mp4')
    .pipe(symlink.absolute(function (file) {
        // Here we return a new Vinyl instance
        return new symlink.File({
          path: 'build/videos/video.mp4',
          cwd: process.cwd()
        });
    }, {force: true}));
})
```

The string options work in the same way. If you pass a string like 'build/videos', the symlink will be created in that directory. If you pass 'build/videos/video.mp4', the symlink will also be renamed.
The function will be called as many times as there are sources.

You might also want to give an array of destination paths:

```js
gulp.task('symlink-array', function () {
  return gulp.src(['modules/assets/', 'modules/client/'])
    .pipe(symlink(['./assets', './client']));
});
```

The default `symlink` performs a relative link. If you want an *absolute symlink* use `symlink.absolute` instead.

### symlink.File

The [vinyl module](https://github.com/wearefractal/vinyl) is exposed here. If you are creating new files with the function as shown above, please use this one.

## Contributing

Pull requests are welcome. If you add functionality, then please add unit tests
to cover it.

## License

MIT © [Ben Briggs](http://beneb.info)

---
_Source: https://npm.io/package/gulp-symlink · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
