KO
|
EN
gitlite — search
Search
#javascript
#python
#hacktoberfest
#react
#ai
#typescript
#llm
#go
#golang
#android
#machine-learning
#rust
#deep-learning
#linux
gulp-rte
★ 11
Open GitHub ↗
Better dest handling for Gulp.
Download README (.md)
Explore Similar Repositories
Chinese-Word-segmentation
:
Implementation Chinese Word Segmentation use HMM
pyscad
:
Python SCAD Interface
anchors-reveal
:
Indicate anchors in a web page
preemptive-kernel-in-win-thread
:
Proof of concept for truly simulating preemptive kernels in a single Windows thread
galaxy-hackathon-2014
:
No description available.
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
gulp-rte
?
Download (.md)
# gulp-rte [](http://badge.fury.io/js/gulp-rte) > Better dest handling for Gulp. ## Install Install with [npm](npmjs.org): ```bash npm i gulp-rte --save-dev ``` ## How it works Substitute **prop-strings** like `:basename`, `:ext`, `:dirname` or [any random string](#random-string) that has a [match on the context](#context) object. The generated `dest` path will be appended to whatever is defined in `gulp.dest()`. **For example:** ```js gulp.src('*.js') .pipe(rte(':basename:ext')) .pipe(gulp.dest('blog')); //=> 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` returns `a/b/c` * `:basename` returns `d.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). ### Custom properties Pass custom properties as a second parameter (continuing with `a/b/c/d.js`): ```js rte(':alpha/:gamma:ext', {alpha: 'one', gamma: 'three'}) //=> one/three.js rte(':alpha/:basename/:gamma:ext', {alpha: 'one', gamma: 'three'}) //=> one/d/three.js ``` ## Usage examples ### Basic example This is just a basic example of what [rte](https://github.com/jonschlinkert/rte) can do: ```js var gulp = require('gulp'); var rte = require('gulp-rte'); // given you have: // ['a/b/c/foo.js', 'a/b/c/bar.js', 'a/b/c/baz.js'] gulp.task('default', function() { return gulp.src('a/b/c/*.js') .pipe(rte(':basename.min:ext')) .pipe(gulp.dest('blog')); }); //=> blog/foo.min.js //=> blog/bar.min.js //=> blog/baz.min.js ``` ### Random string Add a randomized string to any point in a file path: ```js var context = { random: Math.random().toString(36).substr(2, 5); }; gulp.task('default', function() { return gulp.src('a/b/c/*.js') .pipe(rte(':basename-:random.js', context)) .pipe(gulp.dest('blog')); }); //=> blog/foo-qi2os.js //=> blog/bar-s5s7p.js //=> blog/baz-bu96e.js ``` **Any pattern** can be used. For inspiration or examples, see: * [rte](https://github.com/jonschlinkert/rte) * [strings](https://github.com/assemble/strings) * [permalinks](https://github.com/jonschlinkert/permalinks) ## Author **Jon Schlinkert** + [github/jonschlinkert](https://github.com/jonschlinkert) + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license *** _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 28, 2014._