patrickkettner / grunt-compile-handlebars

grunt plugin to compile static html from a handlebars plugin
MIT License
115 stars 29 forks source link

Use setImmediate to start new call stack #10

Closed mattcg closed 10 years ago

mattcg commented 10 years ago

This fixes "Maximum call stack size exceeded errors" when compiling thousands of templates.

patrickkettner commented 10 years ago

thanks for the PR, @mattcg!

This would break 0.8 support - is process.nextTick good enough for your use case?

mattcg commented 10 years ago

I haven't tried with nextTick. Can we use setImmediate if available and fall back to nextTick if it isn't?

patrickkettner commented 10 years ago

Well, if nextTick works for your needs, I would just use that, if it doesn't, then I will need to consider wether or not I want to drop 0.8 support.

mattcg commented 10 years ago

Confirmed working with process.nextTick. I've amended the pull request.

patrickkettner commented 10 years ago

Thanks, @mattcg. Sorry for the delay, could you squish your pr to a single commit to help keep the history neat?

thanks again!

mattcg commented 10 years ago

To be honest, that's a bit of a hassle and it'd make sense to have the reason for not using setImmediate in the commit log.

patrickkettner commented 10 years ago

fair enough. I'll add this manually and bump the version.

thanks a lot for the report!

patrickkettner commented 10 years ago

pushed in 0.6.3.

thanks again @mattcg

mattcg commented 10 years ago

Thank you :)

patrickkettner commented 10 years ago

my pleasure :D