Friday, August 31, 2018

Harp/Jade Debug Snippet

I’m using Harp with Jade recently. At the beginning, it was hard for me to figure out the JSON data structure used by Harp at build time. It was also hard to debug JavaScript function written in Jade and executed at Harp compile time. In the end, I figured out that I could dump that JSON as a string to console.log in browser. Everything is so much easier now.

Now I have that debug.jade file in my project. Whenever I want to examine some JSON data in Harp, I just call != partial('debug', { data: anything }) and pass the right data.