jade-var-matter

0.0.5 • Public • Published

jade-var-matter

Build Status Coverage Status Dependency Status devDependency Status NPM

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 }

Dependents (0)

Package Sidebar

Install

npm i jade-var-matter

Weekly Downloads

1

Version

0.0.5

License

MIT

Last publish

Collaborators

  • jessaustin