Frontmatter
| id | 2142 |
| title | Add a micro loader to the index.html files |
| state | Closed |
| labels | enhancement |
| assignees | tobiu |
| createdAt | May 24, 2021, 10:54 PM |
| updatedAt | May 25, 2021, 7:31 PM |
| githubUrl | https://github.com/neomjs/neo/issues/2142 |
| author | tobiu |
| commentsCount | 2 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | May 25, 2021, 7:31 PM |
Add a micro loader to the index.html files
tobiu assigned to @tobiu on May 24, 2021, 10:54 PM
tobiu cross-referenced by #2143 on May 25, 2021, 10:42 AM

tobiu
May 25, 2021, 10:45 AM
updated the top level post to include the micro loader getting moved into an own file.

tobiu
May 25, 2021, 7:31 PM
all index files inside the main repo are adjusted now. will create follow up tickets for the build scripts.
tobiu closed this issue on May 25, 2021, 7:31 PM
before:
<!DOCTYPE HTML> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="UTF-8"> <title>COVID-19 IN NUMBERS</title> </head> <body> <script> Neo = self.Neo || {}; Neo.config = Neo.config || {}; Object.assign(Neo.config, { appPath : 'apps/covid/app.mjs', basePath : '../../', environment : 'development', mainThreadAddons: ['AmCharts', 'DragDrop', 'MapboxGL', 'Stylesheet'], themes : ['neo-theme-dark', 'neo-theme-light'] }); </script> <script src="../../src/Main.mjs" type="module"></script> </body> </html>new version:
<!DOCTYPE HTML> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="UTF-8"> <title>COVID-19 IN NUMBERS</title> </head> <body> <script src="../../src/MicroLoader.mjs" type="module"></script> </body> </html>neo-config.json:
{ "appPath" : "apps/covid/app.mjs", "basePath" : "../../", "environment" : "development", "mainPath" : "./Main.mjs", "mainThreadAddons": ["AmCharts", "DragDrop", "MapboxGL", "Stylesheet"], "themes" : ["neo-theme-dark", "neo-theme-light"] }MicroLoader.mjs:
fetch('./neo-config.json').then(response => response.json()).then(data => { self.Neo = {config: {}}; Object.assign(Neo.config, data); import(data.mainPath); });It is a tiny bit slower, but feels much cleaner.
Especially when we are moving folders around (e.g. copying the docs app & examples into a workspace, we do not have to deal with string manipulations.