open-wc / open-wc-starter-app

Starter app based on Open Web Components Recommendations
https://open-wc.org/
93 stars 14 forks source link

Include features from create-lit-app #6

Closed goatandsheep closed 5 years ago

goatandsheep commented 5 years ago

If we're deprecating create-lit-app, we need to integrate the features from it, e.g.

thepassle commented 5 years ago

Redux and vaadin router were only included in create-lit-app-advanced. I think it's unlikely that we'll add redux and the vaadin router in this starter-app, as we're trying to keep entry-level low, however we do plan on making a bigger scale starter-app: https://github.com/open-wc/open-wc/issues/197

I can't assure redux and vaadin router will be included there either though. Fortunately, adding redux and vaadin router don't have to do much with the project configuration. You can add them like so:

npm i redux pwa-helpers @vaadin/router

add a store.js: https://github.com/thepassle/create-lit-app-advanced/blob/master/src/store.js

and add the router code to your my-app.js:

import { Router } from '@vaadin/router';

...

    firstUpdated(){
        const router = new Router(this.shadowRoot.querySelector('#outlet'));

        router.setRoutes([
            {path: '/', component: 'hello-world'},
            {path: '/books', component: 'books-demo'},
            {path: '/redux', component: 'redux-demo'},
            {path: '(.*)', component: 'not-found'}
        ]);
    }

You can also simply copy the files from https://github.com/thepassle/create-lit-app-advanced as the code has not much to do with the project configuration itself, and should still work if implemented here. Hopefully thats helpful to you :)

goatandsheep commented 5 years ago

That is helpful. Thanks!