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

[FEATURE]: CSS supercharge for Google-Bot and robustness #1478

Closed
2 of 3 tasks
migbash opened this issue Jul 26, 2023 · 0 comments
Closed
2 of 3 tasks

[FEATURE]: CSS supercharge for Google-Bot and robustness #1478

migbash opened this issue Jul 26, 2023 · 0 comments
Assignees
Labels

Comments

@migbash
Copy link
Collaborator

migbash commented Jul 26, 2023

Does a duplicate issue exist?

  • I have searched the existing issues

🤔 Is feature request related to a problem? Please describe the problem.

Google-Bot (Mobile-Friendly Test) is failing due to unknown domain restrictions, but theorised to be due to the domain rating. Requires a solution to get the website visibility on Google and better Google Rating.

This issue proposes the necessary solutions to get this issue of type wontfix to be fixed.

In addition, it's outlined the steps, solutions, resources necessary to get this feature working.

📝 Feature Request Description

This feature aims to tackle the bug/wontfix issue(s):

As explained previously in the latest issue #1278, trouble arises every-time the Google-Bot aims to access the Production version website, due to anomalies in Goggle-Bot and/or it's underlying domain rating categorisation.


🟩 Solution

By:

  • Altering the bundle process to generate a single CSS chunk from all .svelte files, and,
  • Supercharging the CSS to take the main role of handling the page layout components show/hide logic of different device viewports changes - moving it away from the current JS implementation.

We can guarantee the valid CSS and style is shown to the user, regardless of wether they have JS enabled or not, and thus solving the Google-Bot issue once and for all, as CSS can be dumped into a single file for the entire project.


📑 In detail

The implementation of the single CSS chunk dump for a sveltekit project has been tackled, a valid solution has been implemented, and stashed.

This feature focuses on the implementation of the CSS Supercharge, to move away from Js the logic of device viewport handling and layout change. Nothing else.

In this feature the following changes are expected:

  1. CSS will be enriched with many more @media queries, and its inner block code, to show/hide specific sections of the component/page, depending on user device viewport and device width.
<style>

[...]

@media only screen and (min-width: 726px) 
{
  div#show-on-mobile
  {
    display: none;
  }

[...]

</style>

Note
This logic was not implemented from the start, due to the fact that it was simpler to manage viewport with JS and use variables to also trigger functions/logic for the svelte component when device viewport/width changed in some cases, where it was necessary to confirm user device before executing a function. This can now be solved with 2..

  1. CSS will be enriched in some .svelte component, to adjust a unique CSS Variable depending on user device viewport/width. For example, as illustrated below:
📌 global.css

:root 
{
  --header-is-mobile: 'true';
}
📌 component-A.svelte

<style>

@media screen and (max-width: 520px) 
{
   :root 
   {
      /*
      ### NOTE:
      ### updates global variable, for target viewport/width 
      */
      --header-is-mobile: 'false';
   }
}

</style>

This change can then be picked up by the following code logic in JS (if JS is available on the browser, and page resources are correctly loaded).

📌 component-A.svelte

[...]

let value = 'true';

const styleObserver = new MutationObserver
(
  (mutations) => 
  {
    const currentValue = mutations[0].target.style.getPropertyValue('--var1');

    if (currentValue !== value) 
    {
      // ### NOTE:
      // ### The css-variable has changed
      value = currentValue;
    }
});

styleObserver.observe
(
  document.documentElement, 
 {
    attributes: true,
    attributeFilter: ['style'],
  }
);

[...]

Note
Please refer to the ➕ Further context and resources for links and sources to above code and further information.

➕ Further context and resources (cummulative)

📚 Resources

@jonsnowpt jonsnowpt assigned jonsnowpt and migbash and unassigned jonsnowpt and migbash Jul 27, 2023
migbash added a commit that referenced this issue Aug 9, 2023
migbash added a commit that referenced this issue Aug 9, 2023
migbash added a commit that referenced this issue Aug 9, 2023
migbash added a commit that referenced this issue Aug 9, 2023
migbash added a commit that referenced this issue Aug 9, 2023
* issue: #1278

* issue: #1278; cont;

* issue: #1278; cont;

* issue: #1278; cont;

* issue: #1278; cont;

* issue: #1278; cont;

* issue: #1278; cont;

* issue: #1278; cont; dynamic svg import;

* issue: #1278; cont; dynamic home-page comp import;

* issue: #1278; cont; dynamic home-page comp import;

* chore: Makefile; package.json; update;

* doc: vite.config.ts;

* issue: #1478; Test Header; logic; mobile-first;

* issue: #1478; Test CSS-Js variable communication;

* issue: #1478; vite.config.ts update;

* update: #1478; all-css-chunk.css;

* Revert to e92886 -> home/Layout.svelte;

* update: #1478; all-css-chunk.css;

* update: #1278; empty preloadStrategy;

* update: #1278; preloadStrategy -> preload-js;

* update: #1278; preloadStrategy -> preload-js;

* upd: #1278; preloadStrategy -> preload-js; cont;

* upd: #1278; preloadStrategy -> preload-mjs; cont;

* upd: #1278; build::manualChunks homepage single;

* upd: #1278; build::manualChunks cont;

* upd: #1278; preloadStrategy -> modulepreload;

* upd: #1278; build::manualChunks cont; cssJsChunk;

* upd: #1278; build::manualChunks cont;

* upd: #1278; src/app.html hardcode all CSS;

* revert to ab873 -> vite.config.ts;

* doc: svelte.config.js; vite.config.js;

* update: +layout.server.ts revamp;

* update: +layout.svelte revamp;

* del: +layout.ts in favour of .server.ts;

* doc: [[lang=lang]]/+page.ts;

* chore: remove firebase/common.ts;

* feat: sessionStore add deviceType;

* chore: app.html clean;

* chore: utils/debug.ts clean;

* chore: utils/dates.ts clean;

* chore: utils/platform-functions.ts clean;

* chore: utils/languages.ts clean;

* chore: api/utils.ts clean;

* chore: u/[view]/[lang=lang] page.server.ts;

* update: all homepage widgets entry .svelte;

* update: homepage main Layout.svelte;

* chore: update debug logs on few components;

* issue: #1478; vite.config.ts update;

* update: src/hooks.server.ts;

* update: Auth_Widget.svelte;

* pkg: ua-parser-js; mansory-layout; device-dete-js;

* chore: svelte.config.ts;

* issue: #1478; vite.config.ts update; compression;

* update: +layout.svelte add SplashScreen;

* update: Makefile;

* update: +layout.svelte revert SplashScreen;

* update: +layout.server.ts add setHeaders(..);

* update: svelte.config.ts; add pre-compress;

* update: Makefile;

* update: Makefile;

* issue: #1478; vite.config.ts update; minfication;

* issue: #1478; homepage widgets (some) dynamicload;

* issue: #1478; homepage widgets (cont) dynamicload;

* issue: #1478; single-chunk and in-head css;

* chore: add analytics to app.html;

* doc: svelte.config.ts;

* issue: #1278; adjusting dynamic importing v6.5

* issue: #1278; home/Layout.svelte dynamic v6.5;

* chore: Email-Sub; Offline-Alert; Plat-Alert v6.5;

* chore: Makefile update;

* chore: package.json update;

* chore: translation.ts ;

* chore: +layout.svelte v6.5;

* chore: [[lang=lang]]/+page.svelte v6.5;

* chore: [[lang=lang]]/+page.ts v6.5;
jonsnowpt pushed a commit that referenced this issue Aug 10, 2023
* chore: add vscode/snippets.code-snippets;

* chore: Footer re-structure;

* chore: app.css comments + clean;

* update: +layout Footer re-structure;

* chore: components/home/leagues-list -> v6;

* chore: components/home/leagues-table -> v6;

* chore: components/home/seo-block -> v6;

* upd: +layout league-list; league-table; seo-block;

* update: vscode/snippets.code-snippets;

* update: Makefile;

* update: Makefile;

* update: package.json > scripts;

* update: package.json > scripts;

* update: package.json;

* update: vscode/snippets.code-snippets;

* Feature/1421/user-profile-withdraw (#1479)

* feat: #1421; new Withdraw Widget-Main + Modal;

* feat: #1421; new Withdraw assets;

* feat: #1421; new Withdraw Widget ref +page.svelte;

* chore: clean store/user-settings.ts;

* doc: OpenApi adjust for Tx to DB action endpoint;

* feat: #1421; new balance Firebase upd func; clean;

* feat: #1421; endpoint /api/data/profile POST add;

* update: app.css for global form > input; clean;

* feat: #1421; add Withdraw-Widget Profile/Menu-Opt;

* feat: #1421; endpoint /api/data/profile; cont;

* pkg: @scores-lib ➤ 1.4.0;

* issue: #1483;

* pkg: ibantools 4.3.3;

* pkg: @scores-lib ➤ 1.4.1;

* issue: #1483; withdraw-fixes; cont;

* issue: #1486;

* issue: #1485;

* issue: #1486; cont;

* issue: #1488;

* issue: #1491;

* issue: #1497; #1489; #1495;

* issue: #1497; cont;

* issue: #1504;

* issue: #1506;

* issue: #1507; #1502;

* issue: #1508;

* issue: #1497;

* issue: #1497; cont;

* issue: #1497; cont;

* pkg: @scores-lib ➤ 1.4.4;

* issue: #1491;

* pkg: @scores-lib ➤ 1.4.5;

* issue: #1491; adjust show more action text;

* issue: #1498;

* pkg: @scores-lib ➤ 1.4.6;

* issue: #1498; types update;

* chore: firebase secrets;

* chore: firebase secrets;

* Issue/1278/pre load css js (#1510)

* issue: #1278

* issue: #1278; cont;

* issue: #1278; cont;

* issue: #1278; cont;

* issue: #1278; cont;

* issue: #1278; cont;

* issue: #1278; cont;

* issue: #1278; cont; dynamic svg import;

* issue: #1278; cont; dynamic home-page comp import;

* issue: #1278; cont; dynamic home-page comp import;

* chore: Makefile; package.json; update;

* doc: vite.config.ts;

* issue: #1478; Test Header; logic; mobile-first;

* issue: #1478; Test CSS-Js variable communication;

* issue: #1478; vite.config.ts update;

* update: #1478; all-css-chunk.css;

* Revert to e92886 -> home/Layout.svelte;

* update: #1478; all-css-chunk.css;

* update: #1278; empty preloadStrategy;

* update: #1278; preloadStrategy -> preload-js;

* update: #1278; preloadStrategy -> preload-js;

* upd: #1278; preloadStrategy -> preload-js; cont;

* upd: #1278; preloadStrategy -> preload-mjs; cont;

* upd: #1278; build::manualChunks homepage single;

* upd: #1278; build::manualChunks cont;

* upd: #1278; preloadStrategy -> modulepreload;

* upd: #1278; build::manualChunks cont; cssJsChunk;

* upd: #1278; build::manualChunks cont;

* upd: #1278; src/app.html hardcode all CSS;

* revert to ab873 -> vite.config.ts;

* doc: svelte.config.js; vite.config.js;

* update: +layout.server.ts revamp;

* update: +layout.svelte revamp;

* del: +layout.ts in favour of .server.ts;

* doc: [[lang=lang]]/+page.ts;

* chore: remove firebase/common.ts;

* feat: sessionStore add deviceType;

* chore: app.html clean;

* chore: utils/debug.ts clean;

* chore: utils/dates.ts clean;

* chore: utils/platform-functions.ts clean;

* chore: utils/languages.ts clean;

* chore: api/utils.ts clean;

* chore: u/[view]/[lang=lang] page.server.ts;

* update: all homepage widgets entry .svelte;

* update: homepage main Layout.svelte;

* chore: update debug logs on few components;

* issue: #1478; vite.config.ts update;

* update: src/hooks.server.ts;

* update: Auth_Widget.svelte;

* pkg: ua-parser-js; mansory-layout; device-dete-js;

* chore: svelte.config.ts;

* issue: #1478; vite.config.ts update; compression;

* update: +layout.svelte add SplashScreen;

* update: Makefile;

* update: +layout.svelte revert SplashScreen;

* update: +layout.server.ts add setHeaders(..);

* update: svelte.config.ts; add pre-compress;

* update: Makefile;

* update: Makefile;

* issue: #1478; vite.config.ts update; minfication;

* issue: #1478; homepage widgets (some) dynamicload;

* issue: #1478; homepage widgets (cont) dynamicload;

* issue: #1478; single-chunk and in-head css;

* chore: add analytics to app.html;

* doc: svelte.config.ts;

* issue: #1278; adjusting dynamic importing v6.5

* issue: #1278; home/Layout.svelte dynamic v6.5;

* chore: Email-Sub; Offline-Alert; Plat-Alert v6.5;

* chore: Makefile update;

* chore: package.json update;

* chore: translation.ts ;

* chore: +layout.svelte v6.5;

* chore: [[lang=lang]]/+page.svelte v6.5;

* chore: [[lang=lang]]/+page.ts v6.5;

* chore: fix merge errors;

* fix: adjust hardcoded CSS;

* (empty commit);

* fix: adjust vite.config.ts;

* chore: firebase secrets;

* github: workflow secrets;

* github: workflow secrets;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants