Creates a stream for reading Vinyl objects from the file system.
Note: BOMs (byte order marks) have no purpose in UTF-8 and will be removed from UTF-8 files read by src()
, unless disabled using the removeBOM
option.
const { src, dest } = require('gulp');
function copy() {
return src('input/*.js')
.pipe(dest('output/'));
}
exports.copy = copy;
Signature Parameters parameter type note globs string
A stream that can be used at the beginning or in the middle of a pipeline to add files based on the given globs.
ErrorsWhen the globs
argument can only match one file (such as foo/bar.js
) and no match is found, throws an error with the message, "File not found with singular glob". To suppress this error, set the allowEmpty
option to true
.
When an invalid glob is given in globs
, throws an error with the message, "Invalid glob argument".
For options that accept a function, the passed function will be called with each Vinyl object and must return a value of another listed type.
name type default note encoding stringcontents
property will be a paused stream. It may not be possible to buffer the contents of large files.
.dest()
. since date
symlink
property to the original file's path. cwd string process.cwd()
The directory that will be combined with any relative path to form an absolute path. Is ignored for absolute paths. Use to avoid combining globs
with path.join()
.
base
property on created Vinyl objects. Detailed in API Concepts.
cwd
and base
options should be aligned.
globs
are resolved against.
globs
which can only match one file (such as foo/bar.js
) causes an error to be thrown if they don't find a match. If true, suppresses glob failures.
'path'
Remove duplicates from the stream by comparing the string property name or the result of the function.
cwd
, base
, path
properties). dot boolean false If true, compare globs against dot files, like .gitignore
.
{a,b}
or {1..3}
.
+(ab)
.
/
characters, traverses all directories and matches that glob - e.g. *.js
would be treated as equivalent to **/*.js
.
globs
.
Sourcemap support is built directly into src()
and dest()
, but is disabled by default. Enable it to produce inline or external sourcemaps.
Inline sourcemaps:
const { src, dest } = require('gulp');
const uglify = require('gulp-uglify');
src('input/**/*.js', { sourcemaps: true })
.pipe(uglify())
.pipe(dest('output/', { sourcemaps: true }));
External sourcemaps:
const { src, dest } = require('gulp');
const uglify = require('gulp-uglify');
src('input/**/*.js', { sourcemaps: true })
.pipe(uglify())
.pipe(dest('output/', { sourcemaps: '.' }));
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4