Skip to content

Commit b9935db

Browse files
committed
feat: find covidcast files by prefix
1 parent bbeaba1 commit b9935db

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

themes/delphi/layouts/_default/covidcast_app.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{{ define "styles" }}
2-
<link rel="stylesheet" href="{{ "./covidcast/vendors.css" | relURL }}" />
3-
<link rel="stylesheet" href="{{ "./covidcast/styles.css" | relURL }}" />
2+
<link rel="stylesheet" href="{{ (partial "covidcast/find-file.html" "vendor.*\\.css$")| relURL }}" />
3+
<link rel="stylesheet" href="{{ (partial "covidcast/find-file.html" "styles.*\\.css$")| relURL }}" />
44
{{ end }}
55
{{ define "scripts" }}
6-
<script src="{{ "./covidcast/vendors.js" | relURL }}"></script>
7-
<script src="{{ "./covidcast/styles.js" | relURL }}"></script>
8-
<script src="{{ "./covidcast/bundle.js" | relURL }}"></script>
6+
<script src="{{ (partial "covidcast/find-file.html" "vendor.*\\.js$") | relURL }}"></script>
7+
<script src="{{ (partial "covidcast/find-file.html" "styles.*\\.js$")| relURL }}"></script>
8+
<script src="{{ (partial "covidcast/find-file.html" "bundle.*\\.js$")| relURL }}"></script>
99
{{ end }}
1010
{{ define "body_class" }}covidcast_wrapper{{ end }}
1111
{{ define "main" }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!--find a file given a prefix and directory -->
2+
{{ $pattern := . }}
3+
{{ $matchedFile := false }}
4+
{{ range (readDir "./static/covidcast") }}
5+
{{ $testFile := . }}
6+
{{ with (index (findRE $pattern .Name 1) 0) }}
7+
{{ $matchedFile = path.Join "./covidcast" $testFile.Name }}
8+
{{ end }}
9+
{{ end }}
10+
{{ return $matchedFile }}

0 commit comments

Comments
 (0)