grunt-markade
Advanced tools
Comparing version
@@ -48,2 +48,13 @@ /* | ||
} | ||
}, | ||
with_layout: { | ||
options: { | ||
"template": "test/templates/index.jade", | ||
"jade": { | ||
"pretty": true | ||
} | ||
}, | ||
files: { | ||
"tmp/with_layout.html": "test/fixtures/testing.md" | ||
} | ||
} | ||
@@ -50,0 +61,0 @@ }, |
{ | ||
"name": "grunt-markade", | ||
"description": "A Markade build step for grunt", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/illyism/grunt-markade", | ||
@@ -43,4 +43,4 @@ "author": { | ||
"dependencies": { | ||
"markade": "^0.1.0" | ||
"markade": "^0.1.2" | ||
} | ||
} |
@@ -28,3 +28,3 @@ # grunt-markade | ||
markade: { | ||
your_target: { | ||
tem: { | ||
options: { | ||
@@ -49,3 +49,10 @@ "template": "template.jade" | ||
#### options.jade | ||
Type: `Object` | ||
Default value: `{}` | ||
An object with options to pass to `Jade.compile`. Values like `pretty: true`. | ||
### Usage Examples | ||
@@ -60,6 +67,8 @@ | ||
markade: { | ||
options: {}, | ||
files: { | ||
'dest/default.html': ["src/file.md"], | ||
}, | ||
no_template: { | ||
options: {}, | ||
files: { | ||
'dest/default.html': ["src/file.md"], | ||
}, | ||
} | ||
}, | ||
@@ -76,8 +85,10 @@ }); | ||
markade: { | ||
options: { | ||
template: 'templates/layout.jade' | ||
}, | ||
files: { | ||
'index.html': 'index.md' | ||
}, | ||
layout: { | ||
options: { | ||
template: 'templates/layout.jade' | ||
}, | ||
files: { | ||
'index.html': 'index.md' | ||
}, | ||
} | ||
}, | ||
@@ -102,5 +113,25 @@ }); | ||
}); | ||
``` | ||
#### Jade Options | ||
You can pass objects to Jade. | ||
```js | ||
grunt.initConfig({ | ||
markade: { | ||
with_layout: { | ||
options: { | ||
"template": "templates/index.jade", | ||
"jade": { | ||
"pretty": true | ||
} | ||
}, | ||
files: { | ||
"public/index.html": "data/index.md" | ||
} | ||
} | ||
}, | ||
}); | ||
## Contributing | ||
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/). |
@@ -23,2 +23,3 @@ /* | ||
log: 'log', | ||
jade: {} | ||
}); | ||
@@ -67,9 +68,10 @@ | ||
}).forEach(function(f) { | ||
markade(f.data, template, function(err, html) { | ||
options.jade.filename = options.template || null; | ||
markade(f.data, template, {jade: options.jade}, function(err, html) { | ||
if (err) { | ||
console.error("Markade err", err); | ||
} else { | ||
grunt.file.write(f.dest, html); | ||
grunt.log.writeln('File "' + f.dest + '" created.'); | ||
} | ||
grunt.file.write(f.dest, html); | ||
grunt.log.writeln('File "' + f.dest + '" created.'); | ||
}); | ||
@@ -76,0 +78,0 @@ }); |
@@ -31,3 +31,3 @@ 'use strict'; | ||
default_options: function(test) { | ||
test.expect(1); | ||
test.expect(2); | ||
@@ -39,2 +39,7 @@ var actual = grunt.file.read('tmp/123.html'); | ||
actual = grunt.file.read('tmp/testing.html'); | ||
expected = grunt.file.read('test/expected/testing.html'); | ||
test.equal(actual, expected, 'Can write a directory'); | ||
test.done(); | ||
@@ -51,2 +56,11 @@ }, | ||
}, | ||
pretty_include: function(test) { | ||
test.expect(1); | ||
var actual = grunt.file.read('tmp/with_layout.html'); | ||
var expected = grunt.file.read('test/expected/with_layout.html'); | ||
test.equal(actual, expected, 'Can use extends, include and add options to jade'); | ||
test.done(); | ||
}, | ||
}; |
13063
17.48%17
21.43%189
14.55%132
30.69%Updated