metalsmith
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -193,7 +193,18 @@ | ||
var dest = this.destination(); | ||
if (clean) yield rm(dest); | ||
if (clean) yield rm(path.join(dest, '*')); | ||
var files = yield this.process(); | ||
yield this.write(files); | ||
return files; | ||
}); | ||
/** | ||
* Process files through plugins without writing out files. | ||
* | ||
* @return {Object} | ||
*/ | ||
Metalsmith.prototype.process = unyield(function*(){ | ||
var files = yield this.read(); | ||
files = yield this.run(files); | ||
yield this.write(files); | ||
return files; | ||
@@ -200,0 +211,0 @@ }); |
{ | ||
"name": "metalsmith", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"license": "MIT", | ||
@@ -26,3 +26,3 @@ "repository": "git://github.com/segmentio/metalsmith.git", | ||
"is-utf8": "~0.2.0", | ||
"recursive-readdir": "^1.2.1", | ||
"recursive-readdir": "^1.3.0", | ||
"rimraf": "^2.2.8", | ||
@@ -38,2 +38,4 @@ "stat-mode": "^0.2.0", | ||
"co-mocha": "^1.0.1", | ||
"coveralls": "^2.11.6", | ||
"istanbul": "^0.4.1", | ||
"metalsmith-drafts": "0.0.1", | ||
@@ -40,0 +42,0 @@ "metalsmith-markdown": "0.2.1", |
# Metalsmith [![Build Status](https://travis-ci.org/segmentio/metalsmith.svg)](https://travis-ci.org/segmentio/metalsmith) [![Slack](https://img.shields.io/badge/Slack-Join%20Chat%20→-blue.svg?style=flat-square)](http://metalsmith-slack.herokuapp.com/) | ||
# Metalsmith | ||
[![npm version][npm-badge]][npm-url] | ||
[![Build Status][travis-badge]][travis-url] | ||
[![Coverage Status][coveralls-badge]][coveralls-url] | ||
[![Dependency Status][david-badge]][david-url] | ||
[![Slack chat][slack-badge]][slack-url] | ||
> An extremely simple, _pluggable_ static site generator. | ||
@@ -11,5 +17,6 @@ | ||
.use(markdown()) | ||
.use(templates('handlebars')) | ||
.use(layouts('handlebars')) | ||
.build(function(err) { | ||
if (err) throw err; | ||
console.log('Build finished!'); | ||
}); | ||
@@ -25,5 +32,6 @@ ``` | ||
.use(permalinks('posts/:title')) | ||
.use(templates('handlebars')) | ||
.use(layouts('handlebars')) | ||
.build(function(err) { | ||
if (err) throw err; | ||
console.log('Build finished!'); | ||
}); | ||
@@ -59,5 +67,5 @@ ``` | ||
--- | ||
An informative article. | ||
...would be parsed into... | ||
@@ -96,6 +104,7 @@ | ||
- IRC Channel - it's `#metalsmith` on freenode! | ||
- [Getting to Know Metalsmith](http://www.robinthrift.com/posts/getting-to-know-metalsmith/) - a great series about how to use Metalsmith for your static site. | ||
- [Slack Channel](http://metalsmith-slack.herokuapp.com/) | ||
- [Getting to Know Metalsmith](https://blog.robinthrift.com/2014/04/13/getting-to-know-metalsmith/) - a great series about how to use Metalsmith for your static site. | ||
- [Building a Blog With Metalsmith](https://azurelogic.com/posts/building-a-blog-with-metalsmith/) - a blog post about how to create a basic blog with Metalsmith. Check out the related [video of the talk](https://www.youtube.com/watch?v=cAq5_5Yy7Tg) too! | ||
- [Awesome Metalsmith](https://github.com/lambtron/awesome-metalsmith) - great collection of resources, examples, and tutorials | ||
## CLI | ||
@@ -113,3 +122,3 @@ | ||
"metalsmith-permalinks": "posts/:title", | ||
"metalsmith-templates": "handlebars" | ||
"metalsmith-layouts": "handlebars" | ||
} | ||
@@ -119,6 +128,21 @@ } | ||
You can specify your plugins as either an object or array. Using an array would allow you to specify use of the same plugin multiple times. The above example is then defined as so: | ||
```json | ||
{ | ||
"source": "src", | ||
"destination": "build", | ||
"plugins": [ | ||
{"metalsmith-drafts": true}, | ||
{"metalsmith-markdown": true}, | ||
{"metalsmith-permalinks": "posts/:title"}, | ||
{"metalsmith-templates": "handlebars"} | ||
] | ||
} | ||
``` | ||
And then just install `metalsmith` and the plugins and run the metalsmith CLI... | ||
$ node_modules/.bin/metalsmith | ||
Metalsmith · reading configuration from: /path/to/metalsmith.json | ||
@@ -130,6 +154,8 @@ Metalsmith · successfully built to: /path/to/build | ||
$ metalsmith | ||
Metalsmith · reading configuration from: /path/to/metalsmith.json | ||
Metalsmith · successfully built to: /path/to/build | ||
Options recognised by `metalsmith.json` are `source`, `destination`, `concurrency`, `metadata`, `clean` and `frontmatter` - See "*API*" section below for usage. | ||
Checkout the [static site](examples/static-site), [Jekyll](examples/jekyll) or [Wintersmith](examples/wintersmith) examples to see the CLI in action. | ||
@@ -167,3 +193,3 @@ | ||
Build with the given settings and call `fn(err, files)`. | ||
Build with the given settings and a callback having signature `fn(err, files)`. | ||
@@ -186,8 +212,18 @@ #### #source(path) | ||
#### #frontmatter(boolean) | ||
Set whether to parse YAML frontmatter. Defaults to `true`. | ||
#### #ignore(path) | ||
Ignore files/paths from being loaded into Metalsmith. `path` can be a string, | ||
or an array of paths. Glob syntax is supported via | ||
[minimatch](https://github.com/isaacs/minimatch). | ||
Ignore files/paths from being loaded into Metalsmith. | ||
`path` can be a string, a function, or an array of strings and/or functions. | ||
Strings use the glob syntax from | ||
[minimatch](https://github.com/isaacs/minimatch) to match files and directories | ||
to ignore. Functions are called with the full path to the file as their first | ||
argument, and the `lstat` object returned by Node's `fs.lstat` function as their | ||
second argument, and must return either `true` to ignore the file, or `false` to | ||
keep it. | ||
#### #metadata(json) | ||
@@ -198,5 +234,5 @@ | ||
#### #path(paths...) | ||
Resolve any amount of `paths...` relative to the working directory. This is useful for plugins who want to read extra assets from another directory, for example `./templates`. | ||
Resolve any amount of `paths...` relative to the working directory. This is useful for plugins who want to read extra assets from another directory, for example `./layouts`. | ||
#### #run(files, fn) | ||
@@ -206,3 +242,6 @@ | ||
#### #process(fn) | ||
Process the files like build without writing any files. Callback signature `fn(err, files)`. | ||
## Metadata API | ||
@@ -234,3 +273,3 @@ | ||
would be built with mode ```-rwxrw-r--```, i.e. user-executable. | ||
would be built with mode ```-rwxrw-r--```, i.e. user-executable. | ||
@@ -270,1 +309,12 @@ | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
[npm-badge]: https://img.shields.io/npm/v/metalsmith.svg | ||
[npm-url]: https://www.npmjs.com/package/metalsmith | ||
[travis-badge]: https://travis-ci.org/metalsmith/metalsmith.svg | ||
[travis-url]: https://travis-ci.org/metalsmith/metalsmith | ||
[coveralls-badge]:https://coveralls.io/repos/metalsmith/metalsmith/badge.svg?branch=master&service=github | ||
[coveralls-url]: https://coveralls.io/github/metalsmith/metalsmith?branch=master | ||
[david-badge]: https://david-dm.org/metalsmith/metalsmith.svg | ||
[david-url]: https://david-dm.org/metalsmith/metalsmith | ||
[slack-badge]: https://img.shields.io/badge/Slack-Join%20Chat%20→-blue.svg | ||
[slack-url]: http://metalsmith-slack.herokuapp.com/ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33622
307
308
7
1
Updatedrecursive-readdir@^1.3.0