Conditionally load webcomponents polyfill

This commit is contained in:
Paulus Schoutsen 2015-12-07 20:12:07 -08:00
parent 0d4f681a4e
commit e1990e07c7

View file

@ -1,5 +1,5 @@
<!doctype html> <!doctype html>
<html> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Home Assistant</title> <title>Home Assistant</title>
@ -31,11 +31,21 @@
margin-bottom: 123px; margin-bottom: 123px;
} }
</style> </style>
<link rel='import' href='/static/{{ app_url }}' async>
</head> </head>
<body fullbleed> <body fullbleed>
<div id='init'><img src='/static/favicon-192x192.png' height='192'></div> <div id='init'><img src='/static/favicon-192x192.png' height='192'></div>
<script src='/static/webcomponents-lite.min.js'></script> <script>
<link rel='import' href='/static/{{ app_url }}' /> var webComponentsSupported = ('registerElement' in document &&
'import' in document.createElement('link') &&
'content' in document.createElement('template'))
if (!webComponentsSupported) {
var script = document.createElement('script')
script.async = true
script.src = '/static/webcomponents-lite.min.js'
document.head.appendChild(script)
}
</script>
<home-assistant auth='{{ auth }}' icons='{{ icons }}'></home-assistant> <home-assistant auth='{{ auth }}' icons='{{ icons }}'></home-assistant>
</body> </body>
</html> </html>