Static GitHub Issues

[614] Confusing about the generator usage in Nuxt.js

prev: Not showing error.vue
next: publicPath doesn't work for nuxt generate

Hi, guys,

I found that Nuxt.js adopts the es6 generator feature at many places like https://github.com/nuxt/nuxt.js/blob/master/lib/build.js#L112 , but i can't figure out why .

Is it appropriate to use generators like that ? Converting them into promises via co when they're being called ? Why not just use promises directly and make the code base more readable ?

Any explanations and comments would be appreciated 😀, thanks.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c534">#c534</a>)</em></sub></div>