An open API service indexing awesome lists of open source software.

https://github.com/colingourlay/grunt-writing

Generate a simple collection of HTML posts from markdown, and an index of teasers.
https://github.com/colingourlay/grunt-writing

Last synced: 2 months ago
JSON representation

Generate a simple collection of HTML posts from markdown, and an index of teasers.

Awesome Lists containing this project

README

        

# grunt-writing

> Generate a simple collection of HTML posts from markdown, and an index of teasers.

[![NPM](https://nodei.co/npm/grunt-writing.png)](https://nodei.co/npm/grunt-writing/)

## Getting Started
This plugin requires Grunt `~0.4.1`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-writing --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-writing');
```

## The "writing" task

### Overview
In your project's Gruntfile, add a section named `writing` to the data object passed into `grunt.initConfig()`.

```js
grunt.initConfig({
writing: {
'': {
meta: {
title: '',
description: '',
author: '',
url: '',
lang: ''
},
templates: '',
posts: '',
dest: ''
}
}
});
```

#### Example Config

```js
grunt.initConfig({
writing: {
build: {
meta: {
title: 'The Blog',
description: 'IT\'s a blog',
author: 'The Blogger',
url: 'http://the-blog.com',
lang: 'en'
},
templates: 'src/templates',
posts: 'src/posts',
dest: 'build'
}
}
});
```

### Templates

All templates are expected to be written in jade. The templates folder _must_ contain a minimum of 3 files: `post.jade`, `index.jade` & `archive.jade`. You're free to use whatever layouts / mixins you want, but you can't change the names of these files.

The `post` object is available to the `post.jade` template. The `posts` array is available to the `index.jade` and `archive.jade` templates. The `meta` object is available to all 3 templates (as well as your layouts).

#### RSS Feed

The `rssURL` property is added to the `meta` object for use in templating.

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/colingourlay/grunt-writing/trend.png)](https://bitdeli.com/free "Bitdeli Badge")