Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds front-matter to all of the docs files #2109

Merged
merged 1 commit into from Jan 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/API.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: api
title: API
-->

## gulp API docs

* [gulp.src](#gulpsrcglobs-options) - Emit files matching one or more globs
Expand Down
7 changes: 6 additions & 1 deletion docs/CLI.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: cli
title: CLI
-->

## gulp CLI docs

### Flags
Expand Down Expand Up @@ -105,7 +110,7 @@ Output:

Command: `gulp --tasks-simple`

Output:
Output:
```shell
one
two
Expand Down
5 changes: 5 additions & 0 deletions docs/FAQ.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: faq
title: FAQ
-->

# FAQ

## Why gulp? Why not ____?
Expand Down
5 changes: 5 additions & 0 deletions docs/getting-started.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: getting-started
title: Getting Started
-->

# Getting Started

*If you've previously installed gulp globally, run `npm rm --global gulp` before following these instructions.* For more information, read this [Sip](https://medium.com/gulpjs/gulp-sips-command-line-interface-e53411d4467).
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/automate-release-workflow.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: automate-release-workflow
title: Automate Release Workflow
-->

# Automate release workflow

If your project follows a semantic versioning, it may be a good idea to automatize the steps needed to do a release.
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/browserify-multiple-destination.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: browserify-multiple-destination
title: Browserify + Globs
-->

# Browserify + Globs (multiple destination)

This example shows how to set up a task of bundling multiple entry points into multiple destinations using browserify.
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/browserify-transforms.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: browserify-transforms
title: Browserify + Transforms
-->

# Browserify + Transforms

[Browserify](https://github.com/browserify/browserify) has become an important and indispensable
Expand Down
7 changes: 6 additions & 1 deletion docs/recipes/browserify-uglify-sourcemap.md
@@ -1,10 +1,15 @@
<!-- front-matter
id: browserify-uglify-sourcemap
title: Browserify + Uglify2 with Sourcemaps
-->

# Browserify + Uglify2 with sourcemaps

[Browserify](https://github.com/browserify/browserify) has become an important and indispensable
tool but requires being wrapped before working well with gulp. Below is a simple recipe for using
Browserify with full sourcemaps that resolve to the original individual files.

See also: the [Combining Streams to Handle Errors](https://github.com/gulpjs/gulp/blob/master/docs/recipes/combining-streams-to-handle-errors.md) recipe for handling errors with browserify or uglify in your stream.
See also: the [Combining Streams to Handle Errors](https://github.com/gulpjs/gulp/blob/master/docs/recipes/combining-streams-to-handle-errors.md) recipe for handling errors with browserify or uglify in your stream.

A simple `gulpfile.js` file for Browserify + Uglify2 with sourcemaps:

Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/browserify-with-globs.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: browserify-with-globs
title: Browserify + Globs
-->

# Browserify + Globs

[Browserify + Uglify2](https://github.com/gulpjs/gulp/blob/master/docs/recipes/browserify-uglify-sourcemap.md) shows how to setup a basic gulp task to bundle a JavaScript file with its dependencies, and minify the bundle with UglifyJS while preserving source maps.
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/combining-streams-to-handle-errors.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: combining-streams-to-handle-errors
title: Combining Streams to Handle Errors
-->

# Combining streams to handle errors

By default, emitting an error on a stream will cause it to be thrown unless it already has a listener attached to the `error` event. This gets a bit tricky when you're working with longer pipelines of streams.
Expand Down
7 changes: 6 additions & 1 deletion docs/recipes/cron-task.md
@@ -1,9 +1,14 @@
<!-- front-matter
id: cron-task
title: Cron Task
-->

# Run gulp task via cron job

While logged in via a user that has privileges to run `gulp`, run the following:

crontab -e

to edit your current "[crontab](https://en.wikipedia.org/wiki/Cron)" file.

Typically, within a cron job, you want to run any binary using absolute paths,
Expand Down
4 changes: 4 additions & 0 deletions docs/recipes/delete-files-folder.md
@@ -1,3 +1,7 @@
<!-- front-matter
id: delete-files-folder
title: Delete files and folders
-->

# Delete files and folders

Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/exports-as-tasks.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: export-as-tasks
title: Export as Tasks
-->

# Exports as Tasks

Using the ES2015 module syntax you can use your exports as tasks.
Expand Down
7 changes: 6 additions & 1 deletion docs/recipes/fast-browserify-builds-with-watchify.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: fast-browserify-builds-with-watchify
title: Fast Browserify builds with Watchify
-->

# Fast browserify builds with watchify

As a [browserify](https://github.com/browserify/browserify) project begins to expand, the time to bundle it slowly gets longer and longer. While it might start at 1 second, it's possible to be waiting 30 seconds for your project to build on particularly large projects.
Expand All @@ -24,7 +29,7 @@ var customOpts = {
debug: true
};
var opts = assign({}, watchify.args, customOpts);
var b = watchify(browserify(opts));
var b = watchify(browserify(opts));

// add transformations here
// i.e. b.transform(coffeeify);
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/handling-the-delete-event-on-watch.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: handling-the-delete-event-on-watch
title: Handling the Delete Event on Watch
-->

# Handling the Delete Event on Watch

You can listen for `'unlink'` events to fire on the watcher returned from `gulp.watch`.
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/incremental-builds-with-concatenate.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: incremental-builds-with-concatenate
title: Incremental Rebuilding
-->

# Incremental rebuilding, including operating on full file sets

The trouble with incremental rebuilds is you often want to operate on _all_ processed files, not just single files. For example, you may want to lint and module-wrap just the file(s) that have changed, then concatenate it with all other linted and module-wrapped files. This is difficult without the use of temp files.
Expand Down
20 changes: 12 additions & 8 deletions docs/recipes/maintain-directory-structure-while-globbing.md
@@ -1,9 +1,14 @@
<!-- front-matter
id: maintain-directory-structure-while-globbing
title: Maintain Directory Structure while Globbing
-->

# Maintain Directory Structure while Globbing

If you are planning to read a few files/folders from a directory and maintain their relative path, you need to pass `{base: '.'}` as the second argument to `gulp.src()`.


For example, if you have a directory structure like
For example, if you have a directory structure like

![Dev setup](https://cloud.githubusercontent.com/assets/2562992/3178498/bedf75b4-ec1a-11e3-8a71-a150ad94b450.png)

Expand All @@ -27,18 +32,17 @@ If you want to maintain the structure, you need to pass `{base: '.'}` to `gulp.s

```js
gulp.task('task', function () {
return gulp.src(['index.html',
'css/**',
'js/**',
'lib/**',
'images/**',
return gulp.src(['index.html',
'css/**',
'js/**',
'lib/**',
'images/**',
'plugin/**'
], {base: '.'})
.pipe(operation1())
.pipe(operation2());
});
```
And the input to your `operation1()` will be a folder structure like
And the input to your `operation1()` will be a folder structure like

![with-base](https://cloud.githubusercontent.com/assets/2562992/3178607/053d6722-ec1c-11e3-9ba8-7ce39e1a480e.png)

13 changes: 9 additions & 4 deletions docs/recipes/make-stream-from-buffer.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: make-stream-from-buffer
title: Make Stream from Buffer
-->

# Make stream from buffer (memory contents)

Sometimes you may need to start a stream with files that their contents are in a variable and not in a physical file. In other words, how to start a 'gulp' stream without using `gulp.src()`.
Expand Down Expand Up @@ -78,9 +83,9 @@ gulp.task('write-versions', function() {
availableVersions.forEach(function(v) {
// make a new stream with fake file name
var stream = source('final.' + v);

var streamEnd = stream;

// we load the data from the concatenated libs
var fileContents = memory['libs.concat.js'] +
// we add the version's data
Expand All @@ -99,11 +104,11 @@ gulp.task('write-versions', function() {
.pipe(vinylBuffer())
//.pipe(tap(function(file) { /* do something with the file contents here */ }))
.pipe(gulp.dest('output'));

// add the end of the stream, otherwise the task would finish before all the processing
// is done
streams.push(streamEnd);

});

return es.merge.apply(this, streams);
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/minified-and-non-minified.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: minified-and-non-minified
title: Outputting Minified and non-minified
-->

# Output both a minified and non-minified version

Outputting both a minified and non-minified version of your combined JavaScript files can be achieved by using `gulp-rename` and piping to `dest` twice (once before minifying and once after minifying):
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/minimal-browsersync-setup-with-gulp4.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: minimal-browsersync-setup-with-gulp4
title: Minimal BrowserSync setup with Gulp 4
-->

# Minimal BrowserSync setup with Gulp 4

[BrowserSync](https://www.browsersync.io/) is a great tool to streamline
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/mocha-test-runner-with-gulp.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: mocha-test-runner-with-gulp
title: Mocha test-runner with Gulp
-->

# Mocha test-runner with gulp

### Passing shared module in all tests
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/only-pass-through-changed-files.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: only-pass-through-changed-files
title: Only Pass Through Changed Files
-->

# Only pass through changed files

Files are passed through the whole pipe chain on every run by default. By using [gulp-changed](https://github.com/sindresorhus/gulp-changed) only changed files will be passed through. This can speed up consecutive runs considerably.
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/pass-arguments-from-cli.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: pass-arguments-from-cli
title: Pass Arguments from the CLI
-->

# Pass arguments from the command line

```js
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/rebuild-only-files-that-change.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: rebuild-only-files-that-change
title: Rebuild only files that Change
-->

# Rebuild only files that change

With [`gulp-watch`](https://github.com/floatdrop/gulp-watch):
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/rollup-with-rollup-stream.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: rollup-with-rollup-stream
title: Rollup with Rollup-Stream
-->

# Rollup with rollup-stream

Like Browserify, [Rollup](https://rollupjs.org/) is a bundler and thus only fits naturally into gulp if it's at the start of the pipeline. Unlike Browserify, Rollup doesn't natively produce a stream as output and needs to be wrapped before it can take this position. [rollup-stream](https://github.com/Permutatrix/rollup-stream) does this for you, producing output just like that of Browserify's `bundle()` method&mdash;as a result, most of the Browserify recipes here will also work with rollup-stream.
Expand Down
7 changes: 6 additions & 1 deletion docs/recipes/run-grunt-tasks-from-gulp.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: run-grunt-tasks-from-gulp
title: Run Grunt Tasks from Gulp
-->

# Run Grunt Tasks from Gulp

It is possible to run Grunt tasks / Grunt plugins from within Gulp. This can be useful during a gradual migration from Grunt to Gulp or if there's a specific plugin that you need. With the described approach no Grunt CLI and no Gruntfile is required.
Expand Down Expand Up @@ -32,7 +37,7 @@ gulp.task('copy', function (done) {

```

Now start the task with:
Now start the task with:
`gulp copy`

With the aforementioned approach the grunt tasks get registered within gulp's task system. **Keep in mind grunt tasks are usually blocking (unlike gulp), therefore no other task (not even a gulp task) can run until a grunt task is completed.**
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/running-shell-commands.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: running-shell-commands
title: Running Shell Commands
-->

# Running Shell Commands

Sometimes it is helpful to be able to call existing command line tools from gulp.
Expand Down
9 changes: 7 additions & 2 deletions docs/recipes/running-task-steps-per-folder.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: running-task-steps-per-folder
title: Generating a file per Folder
-->

# Generating a file per folder

If you have a set of folders, and wish to perform a set of tasks on each, for instance...
Expand Down Expand Up @@ -44,11 +49,11 @@ gulp.task('scripts', function() {
// concat into foldername.js
.pipe(concat(folder + '.js'))
// write to output
.pipe(gulp.dest(scriptsPath))
.pipe(gulp.dest(scriptsPath))
// minify
.pipe(uglify())
// rename to folder.min.js
.pipe(rename(folder + '.min.js'))
.pipe(rename(folder + '.min.js'))
// write to output again
.pipe(gulp.dest(scriptsPath));
});
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/running-tasks-in-series.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: running-tasks-in-series
title: Running Tasks in Series
-->

# Running tasks in series

By default, gulp CLI run tasks with maximum concurrency - e.g. it launches
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/server-with-livereload-and-css-injection.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: server-with-livereload-and-css-inject
title: Server with Live-Reloading and CSS Injection
-->

# Server with live-reloading and CSS injection

With [BrowserSync](https://browsersync.io) and gulp, you can easily create a development server that is accessible to any device on the same WiFi network. BrowserSync also has live-reload built in, so there's nothing else to configure.
Expand Down
5 changes: 5 additions & 0 deletions docs/recipes/sharing-streams-with-stream-factories.md
@@ -1,3 +1,8 @@
<!-- front-matter
id: sharing-streams-with-stream-factories
title: Sharing Streams with Stream Factories
-->

# Sharing streams with stream factories

If you use the same plugins in multiple tasks you might find yourself getting that itch to DRY things up. This method will allow you to create factories to split out your commonly used stream chains.
Expand Down