gulp-dest
v0.2.3
Published
Gulp plugin for easily defining destination paths using path variables.
Downloads
4,408
Maintainers
Readme
gulp-dest
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 ingulp.dest()
- options
{Object}
: Pass file path properties to use. Supported properties areext
orextname
,dirname
andbasename
(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
- gulp-assemble: Gulp plugin for Assemble. | homepage
- gulp-drafts: Gulp plugin for removing files flagged as drafts. Can also be used as an assemble… more | homepage
- gulp-extname: gulp plugin to dynamically rewrite dest extensions based on src extensions. | homepage
- gulp-routes: Add middleware to run for specified routes in your gulp pipeline. | homepage
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.