groc icon indicating copy to clipboard operation
groc copied to clipboard

Include example run command from node

Open dominicbosch opened this issue 12 years ago • 2 comments

I love the tool, it helps me in a great way to do my stuff!

But I want to run it from node and not the terminal. I have groc in my package.json dependencies which makes it instantly available and runnable for everybody in the project scope. I had quite a hassle to find the exact syntax on how to do this with certain options.

It was easy when the options were only the files to be used for the documentation, but as soon as I wanted to switch to a different output folder, it got a bit difficult to figure that out. I also tried it with the .groc.json config file, but that wasn't possible when calling groc.CLI(...).

I still have the feeling I might use the wrong entry point (groc.CLI(...)) for my approach...?

dominicbosch avatar Nov 14 '13 08:11 dominicbosch

Interesting. I came up with a completely different method when we were integrating groc into our documentation server. Here's a simplified version of what we did:

     var groc = require('groc');
     var project = new groc.Project('/web/myProject', 'docs');
     project.options.requireWhitespaceAfterToken = true;
     project.index = 'INDEX.md';
     project.files = ['file1.js', 'file2.js', 'INDEX.md'];
     project.generate({ style: groc.styles.Gilt }, function (err) {});

kmdavis avatar Dec 20 '13 16:12 kmdavis

looks nice and easy for my task. But through CLI you'd have more options if required. I still vote for an example that shows groc usage directly from node executed js code and not only the command line.

dominicbosch avatar Apr 28 '14 20:04 dominicbosch