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
Tweak index.html #657
Tweak index.html #657
Conversation
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.
Some files could not be reviewed due to errors:
Cannot read config file: .eslintrc.json
Cannot read config file: .eslintrc.json Error: ENOENT: no such file or directory, open '.eslintrc.json' Referenced from: .eslintrc Error: Cannot read config file: .eslintrc.json at Object.fs.openSync (fs.js:652:18) at Object.fs.readFileSync (fs.js:553:33) at readFile (/app/node_modules/eslint/lib/config/config-file.js:64:15) at loadJSONConfigFile (/app/node_modules/eslint/lib/config/config-file.js:114:41) at loadConfigFile (/app/node_modules/eslint/lib/config/config-file.js:225:26) at loadFromDisk (/app/node_modules/eslint/lib/config/config-file.js:530:18) at load (/app/node_modules/eslint/lib/config/config-file.js:592:20) at configExtends.reduceRight (/app/node_modules/eslint/lib/config/config-file.js:421:36) at Array.reduceRight () at applyExtends (/app/node_modules/eslint/lib/config/config-file.js:403:28)
141f357
to
48ae97f
Compare
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.
Some files could not be reviewed due to errors:
Cannot read config file: .eslintrc.json
Cannot read config file: .eslintrc.json Error: ENOENT: no such file or directory, open '.eslintrc.json' Referenced from: .eslintrc Error: Cannot read config file: .eslintrc.json at Object.fs.openSync (fs.js:652:18) at Object.fs.readFileSync (fs.js:553:33) at readFile (/app/node_modules/eslint/lib/config/config-file.js:64:15) at loadJSONConfigFile (/app/node_modules/eslint/lib/config/config-file.js:114:41) at loadConfigFile (/app/node_modules/eslint/lib/config/config-file.js:225:26) at loadFromDisk (/app/node_modules/eslint/lib/config/config-file.js:530:18) at load (/app/node_modules/eslint/lib/config/config-file.js:592:20) at configExtends.reduceRight (/app/node_modules/eslint/lib/config/config-file.js:421:36) at Array.reduceRight () at applyExtends (/app/node_modules/eslint/lib/config/config-file.js:403:28)
const compatibilityPath = `/frontend_es5/compatibility-${md5(path.resolve(config.output_es5, 'compatibility.js'))}.js`; | ||
const es5Extra = ` | ||
<script src='${compatibilityPath}'></script> | ||
<script src='/frontend_es5/custom-elements-es5-adapter.js'></script> |
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.
Does minifier inlines those 2 scripts?
It would be great if it did.
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 can add that. Should we inline core.js too?
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.
There are pros and cons:
On cold start it will save a round trip.
However index.html is fetched each time time to update cache, so by increasing this file we waste traffic.
Another option is to unite core+compatibility+adapter to a single file.
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.
Just realized that we can't combine custom-elements-es5-adapter.js
with anything else. It will contain invalid syntax for older browsers which stops execution of the rest of the file.
I'm going ahead and merge this PR because the backend PR got merged. I'll open a PR with updates if any comments come in. |
Further optimizes the generation of index.html:
compatibility.js
link to a working urlcompatibility.js
(to fix translations in iOS 9)compatibility.js
andcustom_elements_es5_adapter.js
in ES5 index.html.index.html
Backend PR: home-assistant/core#10696
For the future, maybe we should combine
compatibility.js
andcustom_elements_es5_adapter.js
into 1 file?