Nuxt.js: Store generation

Created on 25 Dec 2016  路  9Comments  路  Source: nuxt/nuxt.js

Hi ! And merry christmas to you all !

I've discovered Nuxt quite recently and I must admit I find it quite revolutionary and awesome. Thanks for bringing it to us.
For my vue projects, I use to generate the router and the store by reading directories in a way that is similar to the way to create pages. So I wonder if you'd be interested in doing the same for the store ?
I mean that each file of the store directory would contain all data and methods for a module, an example can be found in vue-electron or in my (quite recent) fork I made of nuxt.

I know that this is not an important feature for the version 1.0 you are planning to release soon, so I am not excepting any anwser soon.

Keep up the good work !

This feature request is available on Nuxt.js community (#c63)
question

Most helpful comment

Nice, I'll work on that and make a proposition soon

All 9 comments

Hi @Granipouss and thank you for your kind words!

I understand your idea and it makes sense.

The actual problem I see is that it will remove the possibility of having the official vuex directory structure: http://vuex.vuejs.org/en/structure.html

Indeed that's an issue.
Maybe check if there is an index.js and if it returns a valid store, if not, nuxt generates the proper store. Or do according to the configuration file

It might be a solution indeed and let the users create easily a store with Nuxt.js, I keep it open 馃憤

Nice, I'll work on that and make a proposition soon

So here is the thing:
https://github.com/Granipouss/nuxt.js/blob/master/lib/app/store.js
and the example that goes with it:
https://github.com/Granipouss/nuxt.js/tree/master/examples/vuex-store-2

I hope tat the coding style suit you. Shall I do a pull request ?

Sure, great work 馃憦

Will be available in the next release 馃帄

It's now available in the 0.9.6!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings