jade-var-matter
v0.0.5
Published
like front-matter, except for Jade files
Downloads
3
Readme
jade-var-matter
Lots of markdown files have YAML front matter, and that's cool. Various modules can parse YAML and other stuff from Markdown text. What if you're using Jade instead? You can't just chuck some YAML at the top, but fortunately you don't need to! All the file-specific variables you're using in your Jade file are already there, in regular old javascript vars:
- var foo = 2;
- var bar = 3, list = [1, 2, 3]
ul
for item in list
- var baz = 5, bax = baz * 4;
li
=item
Jade doesn't need any help using this data, but what if you want to pass it
along to other tools? That's where jade-var-matter
is useful (in the
following, jadeString
refers to the Jade snippet above):
> var matter = require('jade-var-matter');
undefined
> matter(jadeString);
{ baz: 5, list: [ 1, 2, 3 ], bar: 3, foo: 2, bax: 20 }