Created
August 5, 2014 20:20
-
-
Save jamiebuilds/4505100604a86fc8dbbd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Handlebars = require('handlebars'); | |
module.exports = function(grunt) { | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ | |
yaml: { | |
docs: { | |
files: [{ | |
expand: true, | |
cwd: 'src', | |
src: ['**/*.yml'], | |
dest: 'tmp' | |
}] | |
} | |
}, | |
jsonTemplates: { | |
docs: { | |
options: { | |
template: './template.hbs' | |
}, | |
files: [{ | |
expand: true, | |
cwd: 'tmp', | |
src: ['**/*.json'], | |
dest: 'dist', | |
ext: '.html' | |
}] | |
} | |
}, | |
clean: ['tmp', 'dist'] | |
}); | |
grunt.registerMultiTask('jsonTemplates', function() { | |
var options = this.options(); | |
var files = this.files; | |
var template = Handlebars.compile(grunt.file.read(options.template)); | |
this.files.forEach(function(f) { | |
f.src.filter(function(filepath) { | |
return grunt.file.exists(filepath) && !grunt.file.isDir(filepath); | |
}).map(function(filepath) { | |
var json = grunt.file.readJSON(filepath); | |
grunt.file.write(f.dest, template(json)); | |
}); | |
}); | |
}); | |
grunt.registerTask('default', ['clean', 'yaml', 'jsonTemplates']); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test", | |
"version": "0.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"grunt": "^0.4.5", | |
"grunt-contrib-clean": "^0.6.0", | |
"grunt-yaml": "^0.4.1", | |
"handlebars": "^2.0.0-alpha.4", | |
"load-grunt-tasks": "^0.6.0", | |
"underscore": "^1.6.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Marionette.Region</h1> | |
<h4>Extends</h4> | |
<p>Marionette.Controller</p> | |
<h2>Methods</h2> | |
<h3>foo<small>public</small></h3> | |
<p>Here is the description of this method</p> | |
<h4>Params</h4> | |
<table> | |
<tbody> | |
<tr> | |
<th>bar</th> | |
<td>String</td> | |
</tr> | |
<tr> | |
<th>baz</th> | |
<td>Object,Function</td> | |
</tr> | |
</tbody> | |
</table> | |
<h4>Emits</h4> | |
<table> | |
<tbody> | |
<tr> | |
<th>foo</th> | |
<td>Here is the description of this event</td> | |
<td>foo,bar,baz</td> | |
</tr> | |
</tbody> | |
</table> | |
<ul> | |
<li>This Error when something is wrong</li> | |
</ul> | |
<h4>Returns</h4> | |
<p>Marionette.Region</p> | |
<pre>region.show(new View()) | |
region.show(new View()) | |
</pre> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Region", | |
"namespace": "Marionette", | |
"extend": "Marionette.Controller", | |
"methods": { | |
"foo": { | |
"api": "public", | |
"params": { | |
"bar": { | |
"types": [ | |
"String" | |
] | |
}, | |
"baz": { | |
"types": [ | |
"Object", | |
"Function" | |
] | |
} | |
}, | |
"throws": [ | |
"This Error when something is wrong" | |
], | |
"emits": [ | |
{ | |
"name": "show", | |
"description": "Here is the description of this event", | |
"arguments": [ | |
"foo", | |
"bar", | |
"baz" | |
] | |
} | |
], | |
"returns": "Marionette.Region", | |
"description": "Here is the description of this method", | |
"example": "region.show(new View())\nregion.show(new View())\n" | |
} | |
}, | |
"properties": { | |
"foo": { | |
"description": "Here is the description of this property" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Region | |
namespace: Marionette | |
extend: Marionette.Controller | |
methods: | |
foo: | |
api: public | |
params: | |
bar: | |
types: | |
- String | |
baz: | |
types: | |
- Object | |
- Function | |
throws: | |
- This Error when something is wrong | |
emits: | |
- | |
name: show | |
description: Here is the description of this event | |
arguments: | |
- foo | |
- bar | |
- baz | |
returns: Marionette.Region | |
description: Here is the description of this method | |
example: | | |
region.show(new View()) | |
region.show(new View()) | |
properties: | |
foo: | |
description: Here is the description of this property |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment