Skip to content

Commit

Permalink
Docs: Add front-matter to each file (#2109)
Browse files Browse the repository at this point in the history
  • Loading branch information
SomethingNew71 authored and phated committed May 31, 2018
1 parent 86acdea commit d693e49
Show file tree
Hide file tree
Showing 45 changed files with 332 additions and 20 deletions.
7 changes: 7 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: api
title: API
hide_title: true
sidebar_label: API
-->

Note: these docs are for version v4.0.0 (aka `gulp@next`) If you're on gulp
v3.9.1, which is the current default `npm` release, you probably want [that
version's documentation](https://github.com/gulpjs/gulp/blob/v3.9.1/docs/API.md).
Expand Down
9 changes: 8 additions & 1 deletion docs/CLI.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: cli
title: CLI
hide_title: true
sidebar_label: CLI
-->

## gulp CLI docs

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

Command: `gulp --tasks-simple`

Output:
Output:
```shell
one
two
Expand Down
7 changes: 7 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: faq
title: FAQ
hide_title: true
sidebar_label: FAQ
-->

# FAQ

## Why gulp? Why not ____?
Expand Down
7 changes: 7 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: docs
title: Docs
hide_title: true
sidebar_label: Docs
-->

# gulp documentation

* [Getting Started](getting-started.md) - Get started with gulp
Expand Down
7 changes: 7 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: getting-started
title: Getting Started
hide_title: true
sidebar_label: 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
7 changes: 7 additions & 0 deletions docs/recipes/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: recipes
title: Recipes
hide_title: true
sidebar_label: Recipes
-->

# Recipes

* [Automate release workflow](automate-release-workflow.md)
Expand Down
7 changes: 7 additions & 0 deletions docs/recipes/automate-release-workflow.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: automate-release-workflow
title: Automate Release Workflow
hide_title: true
sidebar_label: 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
7 changes: 7 additions & 0 deletions docs/recipes/browserify-multiple-destination.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: browserify-multiple-destination
title: Browserify w/ Multiple Destinations
hide_title: true
sidebar_label: Browserify w/ Multiple Destinations
-->

# 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
7 changes: 7 additions & 0 deletions docs/recipes/browserify-transforms.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: browserify-transforms
title: Browserify + Transforms
hide_title: true
sidebar_label: Browserify + Transforms
-->

# Browserify + Transforms

[Browserify](https://github.com/browserify/browserify) has become an important and indispensable
Expand Down
9 changes: 8 additions & 1 deletion docs/recipes/browserify-uglify-sourcemap.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<!-- front-matter
id: browserify-uglify-sourcemap
title: Browserify + Uglify2 with Sourcemaps
hide_title: true
sidebar_label: 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
7 changes: 7 additions & 0 deletions docs/recipes/browserify-with-globs.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: browserify-with-globs
title: Browserify + Globs
hide_title: true
sidebar_label: 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
7 changes: 7 additions & 0 deletions docs/recipes/combining-streams-to-handle-errors.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: combining-streams-to-handle-errors
title: Combining Streams to Handle Errors
hide_title: true
sidebar_label: 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
9 changes: 8 additions & 1 deletion docs/recipes/cron-task.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<!-- front-matter
id: cron-task
title: Cron Task
hide_title: true
sidebar_label: 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
6 changes: 6 additions & 0 deletions docs/recipes/delete-files-folder.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!-- front-matter
id: delete-files-folder
title: Delete files and folders
hide_title: true
sidebar_label: Delete files and folders
-->

# Delete files and folders

Expand Down
7 changes: 7 additions & 0 deletions docs/recipes/exports-as-tasks.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: export-as-tasks
title: Export as Tasks
hide_title: true
sidebar_label: Export as Tasks
-->

# Exports as Tasks

Using the ES2015 module syntax you can use your exports as tasks.
Expand Down
9 changes: 8 additions & 1 deletion docs/recipes/fast-browserify-builds-with-watchify.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: fast-browserify-builds-with-watchify
title: Fast Browserify builds with Watchify
hide_title: true
sidebar_label: 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 +31,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
7 changes: 7 additions & 0 deletions docs/recipes/handling-the-delete-event-on-watch.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: handling-the-delete-event-on-watch
title: Handling the Delete Event on Watch
hide_title: true
sidebar_label: 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
7 changes: 7 additions & 0 deletions docs/recipes/incremental-builds-with-concatenate.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: incremental-builds-with-concatenate
title: Incremental Rebuilding
hide_title: true
sidebar_label: 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
22 changes: 14 additions & 8 deletions docs/recipes/maintain-directory-structure-while-globbing.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<!-- front-matter
id: maintain-directory-structure-while-globbing
title: Maintain Directory Structure while Globbing
hide_title: true
sidebar_label: 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 +34,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)

15 changes: 11 additions & 4 deletions docs/recipes/make-stream-from-buffer.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: make-stream-from-buffer
title: Make Stream from Buffer
hide_title: true
sidebar_label: 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 +85,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 +106,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
7 changes: 7 additions & 0 deletions docs/recipes/minified-and-non-minified.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: minified-and-non-minified
title: Outputting Minified and non-minified
hide_title: true
sidebar_label: 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
7 changes: 7 additions & 0 deletions docs/recipes/minimal-browsersync-setup-with-gulp4.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: minimal-browsersync-setup-with-gulp4
title: Minimal BrowserSync setup with Gulp 4
hide_title: true
sidebar_label: 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
7 changes: 7 additions & 0 deletions docs/recipes/mocha-test-runner-with-gulp.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: mocha-test-runner-with-gulp
title: Mocha test-runner with Gulp
hide_title: true
sidebar_label: Mocha test-runner with Gulp
-->

# Mocha test-runner with gulp

### Passing shared module in all tests
Expand Down
7 changes: 7 additions & 0 deletions docs/recipes/only-pass-through-changed-files.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: only-pass-through-changed-files
title: Only Pass Through Changed Files
hide_title: true
sidebar_label: 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
7 changes: 7 additions & 0 deletions docs/recipes/pass-arguments-from-cli.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: pass-arguments-from-cli
title: Pass Arguments from the CLI
hide_title: true
sidebar_label: Pass Arguments from the CLI
-->

# Pass arguments from the command line

```js
Expand Down
7 changes: 7 additions & 0 deletions docs/recipes/rebuild-only-files-that-change.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: rebuild-only-files-that-change
title: Rebuild only files that Change
hide_title: true
sidebar_label: Rebuild only files that Change
-->

# Rebuild only files that change

With [`gulp-watch`](https://github.com/floatdrop/gulp-watch):
Expand Down
7 changes: 7 additions & 0 deletions docs/recipes/rollup-with-rollup-stream.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- front-matter
id: rollup-with-rollup-stream
title: Rollup with Rollup-Stream
hide_title: true
sidebar_label: 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
Loading

0 comments on commit d693e49

Please sign in to comment.