Skip to content

Commit

Permalink
adds usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Mar 1, 2015
1 parent 02ede65 commit 05dd4c8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
27 changes: 23 additions & 4 deletions .verb.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,37 @@
{%= include("install-npm", {save: true}) %}

## Running tests
{%= include("tests") %}

## Usage

```js
var gulpRoutes = require('{%= name %}');
var gulpRoutes = require('gulp-routes');
var Router = require('en-route').Router;
var router = new Router();

// define middleware
router.all(/\.hbs/, function (file, next) {
var str = file.contents.toString();
// do anything to `file` that can be done
// in a gulp plugin
file.contents = new Buffer(str);
next();
});

// pass the router tp `gulpRoutes`
var routes = gulpRoutes(router);

gulp.src('*.hbs')
.pipe(routes())
.pipe(gulp.dest('_gh_pages/'));
```


## API
{%= apidocs("index.js") %}

## Running tests
{%= include("tests") %}

## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %})

Expand Down
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,31 @@
npm i gulp-routes --save
```

## Running tests
Install dev dependencies.

```bash
npm i -d && npm test
```


## Usage

```js
var gulpRoutes = require('gulp-routes');
var Router = require('en-route').Router;
var router = new Router();

// define middleware
router.all(/\.hbs/, function (file, next) {
var str = file.contents.toString();
// do anything to `file` that can be done
// in a gulp plugin
file.contents = new Buffer(str);
next();
});

// pass the router tp `gulpRoutes`
var routes = gulpRoutes(router);

gulp.src('*.hbs')
.pipe(routes())
.pipe(gulp.dest('_gh_pages/'));
```


## API
### [gulpRoutes](./index.js#L32)

Expand Down Expand Up @@ -49,6 +60,14 @@ gulp.src('*.hbs')
```


## Running tests
Install dev dependencies.

```bash
npm i -d && npm test
```


## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/assemble/gulp-routes/issues)

Expand Down

0 comments on commit 05dd4c8

Please sign in to comment.