question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE-REQUEST] Offline Build Version of App

See original GitHub issue

@antfu thanks for this idea. here some insights and ideas + changes (i have adapted for use withour server port running in vscode, in vscode I think we do not need real time update. Just run it again if you want insights. Same behavior expected since it is similar to coverage of test).

We would need to allow running the UI offline with loading saved report.json from file (including using vscode webview URI’s) I would open PR, but I do not know how to make a second vite config, to build an additonal version. would be great if we can have it as an addtional script build, like build:app & build:app-offline

a) we would need another html base struct… https://github.com/windicss/windicss-analysis/blob/main/index.html

// output.html
<!DOCTYPE html>
<html lang="en">
<head>
  <script>
    window.localStorage.setItem("report", "###REPLACEJSON###")
  </script>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Windi Analyser</title>
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500&display=swap" rel="stylesheet">
  <script type="module" crossorigin src="###REPLACESCRIPT###"></script>
  <link rel="stylesheet" href="###REPLACESTYLE###">
</head>
<body>
  <div id="app"></div>
  
</body>
</html>

b) we would include additional loader, maybe combine them with if, or do two differnt functions https://github.com/windicss/windicss-analysis/blob/3aec1f1ea9432231fe8c53de2e8162cba1088464/src/logic/state.ts#L7-L12

export async function fetchData(refetch = false) {
  data.value = await fetch(`/api/report.json${refetch ? '?force=true' : ''}`)
    .then(r => r.json())
  return data.value
}
export async function loadData() {
  data.value = JSON.parse(window.localStorage.getItem("report").toString())
  return data.value
}

c) we would need to choose which data to load, somehow (maybe based on some localStorage var) https://github.com/windicss/windicss-analysis/blob/3aec1f1ea9432231fe8c53de2e8162cba1088464/src/main.ts#L20

if (something) {
loadData()
} else {
fetchData()
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alexanderniebuhrcommented, Mar 30, 2021

feature mostly implemented for beta

1reaction
antfucommented, Mar 30, 2021

See: https://github.com/windicss/windicss-analysis/commit/35373911e57f99f0b98bf7a4bad787acea6f3a6a

There is no need to have multiple builds for this.

When you serve the HTML to VS Code, you can do a simple transform and inject this script:

<script>
window.__windicss_analysis_serverless = true
window.__windicss_analysis_report = { ... }
</script>
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature Request] Offline access to Protect via Mobile Apps
The feature would allow users to login via an IP address locally, similar to the Unifi Network app. I know this feature request...
Read more >
Feature Request: Android App that works offline? #199 - GitHub
No. The UI is responsive, works pretty well on mobile devices, I use it personally almost daily - but I don't have the...
Read more >
Feature request - Smart Lighting condition for 'if offline'
Could we have a condition or toggle for apps that run locally, such as Smart lighting' to only run when offline?
Read more >
Collections feature request: Let us mark a collection for offline ...
If we could mark a collection to be available for offline usage, when we don't ... offline, that all devices would get the...
Read more >
Offline app basic functions for Windows and Mac
I understand their is limited support for the Mobile app in offline mode. I am interested to ask if the function will also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found