adding some prefetching, and changing how static files are handled

This commit is contained in:
Adam Piontek 2021-04-07 17:17:08 -04:00
parent 42f487493d
commit 33d36ed713
2 changed files with 15 additions and 20 deletions

View file

@ -23,29 +23,11 @@ defmodule Shift73kWeb.Endpoint do
# when deploying your static files in production.
#
# file list generated by simple ls -1 assets/static/ - then copy/paste here
static_files = ~w(
android-chrome-192x192.png
android-chrome-512x512.png
apple-touch-icon.png
browserconfig.xml
favicon-16x16.png
favicon-32x32.png
favicon.ico
mstile-144x144.png
mstile-150x150.png
mstile-310x150.png
mstile-310x310.png
mstile-70x70.png
robots.txt
safari-pinned-tab.svg
site.webmanifest
)
plug(Plug.Static,
at: "/",
from: :shift73k,
gzip: true,
only: ~w(css fonts images js) ++ static_files
gzip: (Mix.env() not in [:dev, :test]),
only: "priv/static" |> Path.expand() |> File.ls!()
)
# Code reloading can be explicitly enabled under the

View file

@ -6,6 +6,19 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<%= csrf_meta_tag() %>
<%= live_title_tag assigns[:page_title] || "", suffix: assigns[:page_title] && " · Shift73k" || "Shift73k" %>
<link rel="preload" href="<%= Routes.static_path(@conn, "/fonts/lato-latin-300-normal.woff2") %>" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="<%= Routes.static_path(@conn, "/fonts/lato-latin-400-normal.woff2") %>" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="<%= Routes.static_path(@conn, "/fonts/lato-latin-700-normal.woff2") %>" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="apple-touch-icon" sizes="180x180" href="<%= Routes.static_path(@conn, "/apple-touch-icon.png") %>">
<link rel="icon" type="image/png" sizes="32x32" href="<%= Routes.static_path(@conn, "/favicon-32x32.png") %>">
<link rel="icon" type="image/png" sizes="16x16" href="<%= Routes.static_path(@conn, "/favicon-16x16.png") %>">
<link rel="manifest" href="<%= Routes.static_path(@conn, "/site.webmanifest") %>">
<link rel="mask-icon" href="<%= Routes.static_path(@conn, "/safari-pinned-tab.svg") %>" color="#78868a">
<meta name="apple-mobile-web-app-title" content="Shift73k">
<meta name="application-name" content="Shift73k">
<meta name="msapplication-TileColor" content="#ee6c4d">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.ico">
<link phx-track-static rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
<script defer phx-track-static type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
</head>