Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route Based Code Splitting #265

Merged
merged 17 commits into from
Jun 4, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions www/templates/app-template.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html, LitElement } from 'lit-element';
import { html, css, LitElement } from 'lit-element';
import { connectRouter } from 'lit-redux-router';
import { applyMiddleware, createStore, compose as origCompose, combineReducers } from 'redux';
import { lazyReducerEnhancer } from 'pwa-helpers/lazy-reducer-enhancer.js';
Expand All @@ -23,6 +23,13 @@ connectRouter(store);

class AppComponent extends LitElement {

static get styles() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

return css`
.content-outlet {
min-height: 100vh
}`;
}

async connectedCallback() {
super.connectedCallback();
const route = window.location.pathname;
Expand Down Expand Up @@ -97,7 +104,9 @@ class AppComponent extends LitElement {
return html`
<div class='wrapper'>
Copy link
Member

@thescientist13 thescientist13 May 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a shame we need a custom app-template.js just for a few lines of HTML. 🤔

I wonder if we could inherit from Greenwoood's AppComponent and just override just the render method somehow??? That would be pretty slick...

import { html } from 'lit-html';
import { AppComponent } from `@greenwood/cli/src/templates/app-component';

class GreenwoodAppComponent extends AppComponent {

  render() {
    return html`
      <custom-code-goes-here/>
    `;
  }
}

can probably be another issue, but would be good to play around with it now just to see what's possible, just to understand what can / can't be done.

<eve-header></eve-header>
MYROUTES
<div class="content-outlet">
MYROUTES
</div>
<lit-route><h1>404 Not found</h1></lit-route>
<eve-footer></eve-footer>
</div>
Expand Down