-
Notifications
You must be signed in to change notification settings - Fork 10
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
Changes from 7 commits
c888286
096a1d7
9bb4009
b1ea9e3
7ad4e7e
210a982
e0a2a0d
37d7f68
047df37
eaf4aeb
17305cb
4bfec57
8f5b7c1
d1f1144
949a1dc
a1bbfb2
097fedb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { html, LitElement } from 'lit-element'; | ||
import './spinner'; | ||
|
||
class loading extends LitElement { | ||
render() { | ||
return html` | ||
<style> | ||
div { | ||
padding-top:50px; | ||
height: calc(100vh - 110px); | ||
} | ||
h1 { | ||
padding: 30px; | ||
text-align:center; | ||
} | ||
</style> | ||
<div> | ||
<eve-spinner size="100px"></eve-spinner> | ||
<h1>Loading...</h1> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
customElements.define('eve-loading', loading); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { html, LitElement } from 'lit-element'; | ||
|
||
class spinner extends LitElement { | ||
|
||
static get properties() { | ||
return { | ||
size: { | ||
type: String | ||
} | ||
}; | ||
} | ||
|
||
render() { | ||
hutchgrant marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return html` | ||
<style> | ||
.spinner { | ||
width: ${this.size}; | ||
padding: 10px; | ||
margin-left:auto; | ||
margin-right:auto; | ||
} | ||
</style> | ||
<div class="spinner"> | ||
<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" | ||
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="${this.size}" | ||
height="${this.size}" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"> | ||
<path fill="#000" | ||
d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z" | ||
transform="rotate(190.358 25 25)"> | ||
<animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform> | ||
</path> | ||
</svg> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
customElements.define('eve-spinner', spinner); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { html, 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'; | ||
import thunk from 'redux-thunk'; | ||
import '../components/header/header'; | ||
import '../components/footer/footer'; | ||
import '../components/loading/loading'; | ||
|
||
// eslint-disable-next-line no-underscore-dangle | ||
const compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || origCompose; | ||
|
||
// eslint-disable-next-line | ||
const store = createStore( | ||
(state, action) => state, // eslint-disable-line | ||
compose(lazyReducerEnhancer(combineReducers), applyMiddleware(thunk))); | ||
|
||
import '../index/index.js'; | ||
|
||
connectRouter(store); | ||
|
||
class AppComponent extends LitElement { | ||
render() { | ||
return html` | ||
<div class='wrapper'> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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 | ||
hutchgrant marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<lit-route><h1>404 Not found</h1></lit-route> | ||
<eve-footer></eve-footer> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
customElements.define('eve-app', AppComponent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, We should be doing this in webpack.config.common.js for the user by default.
And also do some sort of dynamic creation of
cacheGroups
here like we do in webpack.config.common.js withNormalModuleReplaclementPlugin
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking along the lines of similar to a plugin. If a developer wants custom split routes, they can configure it however they please. But I also agree we should be doing it by default as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I would still like to see this done dynamically generated based on the folders set in the users pages/ directory for now. Easy enough for us to make another issue for thinking about how to make it a public API, likely hand in hand with being able to allow our Graph to also go "deeper" than a depth of one: