README.md in vue-generators-0.1.1 vs README.md in vue-generators-0.1.2

- old
+ new

@@ -1,24 +1,27 @@ # Vue::Generators -vue-generators is an opinionated library for generating Vue components and mixins -for a Rails project. +vue-generators is an opinionated library for generating Vue components, mixins, +and stores for a Rails project. ## Usage ### Help ```bash rails g vue:component -h rails g vue:mixin -h +rails g vue:store -h ``` ### Generate a component ```bash rails g vue:component ButtonCounter ``` -*This will generate `app/javascript/components/ButtonCounter.vue`* +**This will generate:** + +*`app/javascript/components/ButtonCounter.vue`* ```JavaScript <template> <div> </div> </template> @@ -78,12 +81,13 @@ ### Generate a mixin ```bash rails g vue:mixin MyMixin ``` +**This will generate:** -*This will generate `app/javascript/mixins/MyMixin.js`* +*`app/javascript/mixins/MyMixin.js`* ```JavaScript export default { props: { /* @@ -118,9 +122,62 @@ }, */ }, } ``` +### Generate a store + +```bash +rails g vue:store Application +``` + +**This will generate:** + +*`app/javascript/application/store/Store.js`* +```JavaScript +import { actions } from "./actions" +import { getters } from "./getters" +import { mutations } from "./mutations" +import { state } from "./state" + +export default { + namespaced: true, + + actions: actions, + getters: getters, + mutations: mutations, + state: state +} +``` + +*`app/javascript/application/store/actions.js`* +```JavaScript +export const actions = { + +} +``` + +*`app/javascript/application/store/getters.js`* +```JavaScript +export const getters = { + +} +``` + +*`app/javascript/application/store/mutations.js`* +```JavaScript +export const mutations = { +} + +``` + +*`app/javascript/application/store/state.js`* +```JavaScript +export const state = { + +} +``` + ## Installation Add this line to your application's Gemfile: ```ruby