jonschlinkert / gray-matter

Smarter YAML front matter parser, used by metalsmith, Gatsby, Netlify, Assemble, mapbox-gl, phenomic, vuejs vitepress, TinaCMS, Shopify Polaris, Ant Design, Astro, hashicorp, garden, slidev, saber, sourcegraph, and many others. Simple to use, and battle tested. Parses YAML by default but can also parse JSON Front Matter, Coffee Front Matter, TOML Front Matter, and has support for custom parsers. Please follow gray-matter's author: https://github.com/jonschlinkert
https://github.com/jonschlinkert
MIT License
3.97k stars 138 forks source link

Cannot find module 'coffee-script' 'toml' #35

Closed arturi closed 7 years ago

arturi commented 7 years ago

Hey, thanks for the awesome package! I love that I can parse/stringify both ways with it.

I have an encountered a problem when using gray-matter with Browserify for the browser:

Error: Cannot find module 'toml' from '/.../node_modules/gray-matter/lib'
Error: Cannot find module 'coffee-script' from '/.../node_modules/gray-matter/lib'

The issue is obviously resolved when coffee-script and toml are installed. If I understand correctly, Node supports dynamic requires here, while Browserify bundles everything right away. What could be the optimal solution? Maybe moving parsers out of the module and allowing the user to require/set his own? I guess PR #15 solves this.

Thanks!

jonschlinkert commented 7 years ago

gray-matter was refactored, coffee is no longer built-in. see the readme to learn how to add custom engines