gulp-rte
Better dest handling for Gulp.
Install
Install with npm:
npm i gulp-rte --save-dev
How it works
Substitute prop-strings like :basename
, :ext
, :dirname
or any random string that has a match on the context object.
The generated dest
path will be appended to whatever is defined in gulp.dest()
.
For example:
gulp ; //=> blog/a.js, blog/b.js, blog/c.js...
Context
File paths are parsed to create the default context
object, so any of the following will work:
Given the filepath a/b/c/d.js
:
:dirname
returnsa/b/c
:basename
returnsd.js
:ext
|:extname
returns.js
Note that, continuing with this example, the path must actually have an extension for :ext
to return an extension. If an extension doesn't actually exist on the filepath then ext
itself will be returned. An easy way around this is to define ext
as a custom property.
Custom properties
Pass custom properties as a second parameter (continuing with a/b/c/d.js
):
//=> one/three.js //=> one/d/three.js
Usage examples
Basic example
This is just a basic example of what rte can do:
var gulp = ;var rte = ; // given you have:// ['a/b/c/foo.js', 'a/b/c/bar.js', 'a/b/c/baz.js'] gulp;//=> blog/foo.min.js//=> blog/bar.min.js//=> blog/baz.min.js
Random string
Add a radomized string to any point in a file path:
var context = random: Math;; gulp;//=> blog/foo-qi2os.js//=> blog/bar-s5s7p.js//=> blog/baz-bu96e.js
Any pattern can be used. For inspiration or examples, see:
Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on June 28, 2014.