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

Progressive Enhancement ("RedactJS") #354

Closed
1 of 5 tasks
thescientist13 opened this issue May 31, 2020 · 2 comments · Fixed by #477
Closed
1 of 5 tasks

Progressive Enhancement ("RedactJS") #354

thescientist13 opened this issue May 31, 2020 · 2 comments · Fixed by #477
Assignees
Labels
alpha.10 CLI enhancement Improve something existing (e.g. no docs, new APIs, etc) P0 Critical issue that should get addressed ASAP RFC Proposal and changes to workflows, architecture, APIs, etc v0.9.0 v0.10.0

Comments

@thescientist13
Copy link
Member

thescientist13 commented May 31, 2020

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

As part of exploration into #305 and conversations during our recently weekly meetings, it seems like there was something we might have overlooked along the way on this project, and that we designed it SPA first, rather than SSG first. (IMO)

76916456-d8ce4000-6896-11ea-8818-7ec52aaea1e2

I would like to open this issue to evaluate how efficiently we are shipping / bundling the output of Greenwood. I would like to see if there are ways the minimum bundle size could be mitigated even further. A website shouldn't really need all this fancy SPA magic, at least not by default and in the final bundle.

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';

// eslint-disable-next-line no-underscore-dangle
const compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || origCompose;

const store = createStore((state) => state,
  compose(lazyReducerEnhancer(combineReducers), applyMiddleware(thunk))
);

As much as possible a Greenwood site by default should work without all the JS needed to render the site, and otherwise make it fall back gracefully. JavaScript should be seen as a progressive enhancement opted-into by the user.

It should be interest to note that if you disable the index.js bundle from loading on the main site, which is 528 KB (granted about half of that is due to #305 ) the whole site still works except for the fading in / out text on the home page and the shelf sub menu clicks. At least the shelf would probably still work if using native click handler and HTMLElement.... Just some food for thought 🍖 🤔 💭
Screen Shot 2020-05-31 at 3 14 16 PM

Details

We should have at least two modes

  • SSG - should be purely static by default. We have this currently but it is tightly coupled to Hybrid mode in that parts of it can’t work without JavaScript. This however is due to our usage of lit and LitElement for the shelf, so of course lit should be bundled. What if we just used HTMLElement for our core templates?
  • Hybrid (SSG + SPA) - If JavaScript is required / used by the user, we should then bundle that opted-in JavaScript and at least ship it using async / defer.

Vite it a good examples of a project aiming for similar goals
https://twitter.com/youyuxi/status/1265680831625998342
Screen Shot 2020-05-31 at 3 02 30 PM

Also this quote I found from somewhere, which I can confirm...
Screen Shot 2020-05-16 at 1 15 57 PM

@thescientist13 thescientist13 added enhancement Improve something existing (e.g. no docs, new APIs, etc) RFC Proposal and changes to workflows, architecture, APIs, etc labels May 31, 2020
@thescientist13 thescientist13 added this to the MVP milestone May 31, 2020
@thescientist13 thescientist13 self-assigned this May 31, 2020
@thescientist13 thescientist13 added the P0 Critical issue that should get addressed ASAP label May 31, 2020
@thescientist13
Copy link
Member Author

Should create issue for additional enhancements like:

  • inlining (critical) CSS into inline <style> tags
  • inlining JS into inline <script> tags
  • future tracking - intelligent tracking

@thescientist13
Copy link
Member Author

thescientist13 commented Nov 7, 2020

Looking to re-incorporate this as part if #355 because now that we are starting from scratch, we should figure out how to use progressive enhancements (via plugins) to see how we can accomplish this. Should figure out how to enable:

  1. default - ships your code as is
  2. strict mode (via configuration)
  3. support a spa option as a plugin
  4. resolve components are over rendering #348 and inline script not working with strict optimization during development #413

Additional thoughts from #418

Should create issues for additional enhancements like:

  • prefetch / preload / defer / etc
  • <link> modulepreload
  • inlining (critical) CSS into inline <style> tags
  • inlining JS into inline <script> tags
  • intelligent asset copying?

@thescientist13 thescientist13 removed their assignment Nov 8, 2020
@thescientist13 thescientist13 mentioned this issue Nov 12, 2020
12 tasks
@thescientist13 thescientist13 self-assigned this Feb 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha.10 CLI enhancement Improve something existing (e.g. no docs, new APIs, etc) P0 Critical issue that should get addressed ASAP RFC Proposal and changes to workflows, architecture, APIs, etc v0.9.0 v0.10.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant