Local Material Icons (#703)

Remove external dependence on fonts.googleapis.com by vendoring MDI fonts and CSS.
This commit is contained in:
Nikolay Vasilchuk 2019-08-27 20:10:44 +03:00 committed by Brandon Davidson
parent a0b3d861fe
commit 15b87af8ed
9 changed files with 56 additions and 7 deletions

View File

@ -0,0 +1,12 @@
The recommended way to use the Material Icons font is by linking to the web font hosted on Google Fonts:
```html
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
```
Read more in our full usage guide:
http://google.github.io/material-design-icons/#icon-font-for-the-web
Source:
https://github.com/google/material-design-icons

View File

@ -0,0 +1,36 @@
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(MaterialIcons-Regular.woff2) format('woff2'),
url(MaterialIcons-Regular.woff) format('woff'),
url(MaterialIcons-Regular.ttf) format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>ESPHome Dashboard</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="{{ get_static_file_url('fonts/material-icons.css') }}">
<link rel="stylesheet" href="{{ get_static_file_url('materialize.min.css') }}">
<link rel="stylesheet" href="{{ get_static_file_url('materialize-stepper.min.css') }}">
<link rel="stylesheet" href="{{ get_static_file_url('esphome.css') }}">

View File

@ -2,10 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ESPHome Dashboard</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<title>ESPHome Dashboard</title>
<link rel="stylesheet" href="{{ get_static_file_url('fonts/material-icons.css') }}">
<link rel="stylesheet" href="{{ get_static_file_url('materialize.min.css') }}">
<link href="{{ get_static_file_url('esphome.css') }}" rel="stylesheet">
<link rel="stylesheet" href="{{ get_static_file_url('esphome.css') }}">
<link rel="shortcut icon" href="{{ get_static_file_url('favicon.ico') }}">
<script src="{{ get_static_file_url('materialize.min.js') }}"></script>

View File

@ -32,9 +32,10 @@ files = list(filter(os.path.exists, files))
files.sort()
file_types = ('.h', '.c', '.cpp', '.tcc', '.yaml', '.yml', '.ini', '.txt', '.ico', '.svg',
'.py', '.html', '.js', '.md', '.sh', '.css', '.proto', '.conf', '.cfg')
'.py', '.html', '.js', '.md', '.sh', '.css', '.proto', '.conf', '.cfg',
'.eot', '.ttf', '.woff', '.woff2')
cpp_include = ('*.h', '*.c', '*.cpp', '*.tcc')
ignore_types = ('.ico',)
ignore_types = ('.ico', '.eot', '.ttf', '.woff', '.woff2')
LINT_FILE_CHECKS = []
LINT_CONTENT_CHECKS = []
@ -231,7 +232,7 @@ def add_errors(fname, errs):
for fname in files:
_, ext = os.path.splitext(fname)
run_checks(LINT_FILE_CHECKS, fname, fname)
if ext in ('.ico',):
if ext in ignore_types:
continue
try:
with codecs.open(fname, 'r', encoding='utf-8') as f_handle: