Craig Shoemaker
Craig Shoemaker

Reputation: 245

grunt task error 'maximum call stack size exceeded' when using grunt-markdown

When I try to convert a folder with 850+ markdown files to HTML I get an error saying maximum call stack size exceeded

I am using load-grunt-config so my config settings for grunt-markdown are in this stand-alone file:

module.exports = {

    offline: {
        files: [
            {
              expand: true,
              src: 'html/*.md',
              dest: 'offline/Tripwire.Offline/html/',
              ext: '.html'
            }
          ],
        options: { 
          template: 'offline/Tripwire.Offline/markdown-layout.html'
        }
    }
};

I'm trying to figure out if the error is in due to something in grunt itself or if the task needs to be changed.

So my question is: Are there any options available to run the task a different way or make more resources available to the task so it doesn't suffer from the max call stack error?

Upvotes: 0

Views: 530

Answers (1)

vladikoff
vladikoff

Reputation: 1514

There is a tiny bug in the markdown plugin. I sent a PR here: https://github.com/treasonx/grunt-markdown/pull/40

The plugin calls a sync method inside of async, so one way to fix that is to add:

process.nextTick(function() { 
     next(); 
});

You can test it via this example repository: https://github.com/vladikoff/stackoverflow-23702801

Upvotes: 1

Related Questions