gulp-dest

0.2.3 • Public • Published

gulp-dest NPM version

Gulp plugin for easily defining destination paths using path variables.

Install with npm

$ npm i gulp-dest --save

Example

var dest = require('gulp-dest');
var gulp = require('gulp');
 
gulp.task('default', function() {
  gulp.src(['a.hbs', 'b.hbs', 'c.hbs'])
    .pipe(dest('dist', {ext: '.html'}))
    .pipe(gulp.dest('./'))
});
 
//=> ['dist/a.html', 'dist/b.html', 'dist/c.html']

Usage

dest(directory, options);
 
// example
dest('dist', { ext: '.html' });
  • directory {String}: Optionally define a path to be append to the path (file.base) specified in gulp.dest()
  • options {Object}: Pass file path properties to use. Supported properties are ext or extname, dirname and basename (although I'm not sure why you would use it)

Path variables

Dynamically replace variables with actual path values:

Examples

// Given: ['a.coffee', 'b.coffee', 'c.min.coffee']
dest(':name.js');
//=> ['a.js', 'b.js', 'c.min.js']
 
// Given: ['foo/a.coffee', 'bar/b.coffee', 'baz/c.coffee']
dest('qux/:name.js');
//=> ['qux/a.js', 'qux/b.js', 'qux/c.js']

Any properties defined on the options can be used as path variables:

Example

var dest = require('gulp-dest');
var gulp = require('gulp');
 
gulp.task('default', function() {
  gulp.src(['a.coffee', 'b.coffee', 'c.coffee'])
    .pipe(dest(':foo/:name.js', {foo: 'bar'}))
    .pipe(gulp.dest('.'))
});
 
//=> ['bar/a.js', 'bar/b.js', 'bar/c.js']

Related projects

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on October 27, 2015.

Package Sidebar

Install

npm i gulp-dest

Weekly Downloads

1,125

Version

0.2.3

License

MIT

Last publish

Collaborators

  • jonschlinkert