Skip to content

Commit 1df9227

Browse files
authored
refactor: use local static files for ASF CSP rule (#395)
* refactor: use local static files for ASF CSP rule TODO: 1. find jquery 2. google fonts (if we need) * add google fonts & css files
1 parent d676858 commit 1df9227

25 files changed

+151
-17
lines changed

themes/docsy/layouts/partials/head.html

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,13 @@
3030
{{ template "_internal/schema.html" . -}}
3131
{{ template "_internal/twitter_cards.html" . -}}
3232
{{ partialCached "head-css.html" . "asdf" -}}
33-
<script
34-
src="https://code.jquery.com/jquery-3.5.1.min.js"
35-
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
36-
crossorigin="anonymous"></script>
33+
<script src='{{ "/js/jquery.min.js" | relURL }}'></script>
3734
{{ if .Site.Params.offlineSearch -}}
38-
<script
39-
src="https://unpkg.com/lunr@2.3.8/lunr.min.js"
40-
integrity="sha384-vRQ9bDyE0Wnu+lMfm57BlYLO0/XauFuKpVsZPs7KEDwYKktWi5+Kz3MP8++DFlRY"
41-
crossorigin="anonymous"></script>
35+
<script src='{{ "/js/lunr.min.js" | relURL }}'></script>
4236
{{ end -}}
4337

4438
{{ if .Site.Params.prism_syntax_highlighting -}}
45-
<link rel="stylesheet" href="{{ "/css/prism.css" | relURL }}"/>
39+
<link rel="stylesheet" href='{{ "/css/prism.css" | relURL }}'/>
4640
{{ end -}}
4741

4842
{{ partial "hooks/head-end.html" . -}}

themes/docsy/layouts/partials/scripts.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
2-
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
3-
crossorigin="anonymous"></script>
4-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js"
5-
integrity="sha512-UR25UO94eTnCVwjbXozyeVd6ZqpaAE9naiEUBK/A+QDbfSTQFhPGj5lOR6d8tsgbBk84Ggb5A3EkjsOgPRPcKA=="
6-
crossorigin="anonymous"></script>
1+
<script src='{{ "/js/popper.min.js" | relURL }}'></script>
2+
<script src='{{ "/js/bootstrap.min.js" | relURL }}'></script>
3+
74

85
{{ if .Site.Params.mermaid.enable }}
9-
<script src="https://cdn.jsdelivr.net/npm/mermaid@8.13.4/dist/mermaid.min.js" integrity="sha512-JERecFUBbsm75UpkVheAuDOE8NdHjQBrPACfEQYPwvPG+fjgCpHAz1Jw2ci9EXmd3DdfiWth3O3CQvcfEg8gsA==" crossorigin="anonymous"></script>
6+
<script src='{{ "/js/mermaid.min.js" | relURL }}'></script>
107
{{ end }}
118

129
{{ if .Site.Params.markmap.enable }}
@@ -48,7 +45,7 @@
4845
{{ end }}
4946
<!-- To automatically render math in text elements, include the auto-render extension: -->
5047
<script defer src='https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js'
51-
integrity='sha512-ZA/RPrAo88DlwRnnoNVqKINnQNcWERzRK03PDaA4GIJiVZvGFIWQbdWCsUebMZfkWohnfngsDjXzU6PokO4jGw==' crossorigin='anonymous'
48+
integrity='sha512-ZA/RPrAo88DlwRnnoNVqKINnQNcWERzRK03PDaA4GIJiVZvGFIWQbdWCsUebMZfkWohnfngsDjXzU6PokO4jGw==' crossorigin='anonymous'
5249
{{ printf "onload='renderMathInElement(%s, %s);'" (( .Site.Params.katex.html_dom_element | default "document.body" ) | safeJS ) ( printf "%s" ( $.Site.Params.katex.options | jsonify )) | safeHTMLAttr }}></script>
5350
{{ end }}
5451

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* open-sans-300 - latin */
2+
@font-face {
3+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
4+
font-family: 'Open Sans';
5+
font-style: normal;
6+
font-weight: 300;
7+
src: url('../webfonts/open-sans/open-sans-v40-latin-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
8+
}
9+
/* open-sans-300italic - latin */
10+
@font-face {
11+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
12+
font-family: 'Open Sans';
13+
font-style: italic;
14+
font-weight: 300;
15+
src: url('../webfonts/open-sans/open-sans-v40-latin-300italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
16+
}
17+
/* open-sans-regular - latin */
18+
@font-face {
19+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
20+
font-family: 'Open Sans';
21+
font-style: normal;
22+
font-weight: 400;
23+
src: url('../webfonts/open-sans/open-sans-v40-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
24+
}
25+
/* open-sans-italic - latin */
26+
@font-face {
27+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
28+
font-family: 'Open Sans';
29+
font-style: italic;
30+
font-weight: 400;
31+
src: url('../webfonts/open-sans/open-sans-v40-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
32+
}
33+
/* open-sans-700 - latin */
34+
@font-face {
35+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
36+
font-family: 'Open Sans';
37+
font-style: normal;
38+
font-weight: 700;
39+
src: url('../webfonts/open-sans/open-sans-v40-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
40+
}
41+
/* open-sans-700italic - latin */
42+
@font-face {
43+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
44+
font-family: 'Open Sans';
45+
font-style: italic;
46+
font-weight: 700;
47+
src: url('../webfonts/open-sans/open-sans-v40-latin-700italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
48+
}

themes/docsy/static/css/rubik.css

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* rubik-300 - latin */
2+
@font-face {
3+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
4+
font-family: 'Rubik';
5+
font-style: normal;
6+
font-weight: 300;
7+
src: url('../webfonts/rubik/rubik-v28-latin-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
8+
}
9+
/* rubik-regular - latin */
10+
@font-face {
11+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
12+
font-family: 'Rubik';
13+
font-style: normal;
14+
font-weight: 400;
15+
src: url('../webfonts/rubik/rubik-v28-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
16+
}
17+
/* rubik-500 - latin */
18+
@font-face {
19+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
20+
font-family: 'Rubik';
21+
font-style: normal;
22+
font-weight: 500;
23+
src: url('../webfonts/rubik/rubik-v28-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
24+
}
25+
/* rubik-600 - latin */
26+
@font-face {
27+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
28+
font-family: 'Rubik';
29+
font-style: normal;
30+
font-weight: 600;
31+
src: url('../webfonts/rubik/rubik-v28-latin-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
32+
}
33+
/* rubik-700 - latin */
34+
@font-face {
35+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
36+
font-family: 'Rubik';
37+
font-style: normal;
38+
font-weight: 700;
39+
src: url('../webfonts/rubik/rubik-v28-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
40+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* tajawal-300 - latin */
2+
@font-face {
3+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
4+
font-family: 'Tajawal';
5+
font-style: normal;
6+
font-weight: 300;
7+
src: url('../webfonts/tajawal/tajawal-v10-latin-300.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
8+
}
9+
/* tajawal-regular - latin */
10+
@font-face {
11+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
12+
font-family: 'Tajawal';
13+
font-style: normal;
14+
font-weight: 400;
15+
src: url('../webfonts/tajawal/tajawal-v10-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
16+
}
17+
/* tajawal-500 - latin */
18+
@font-face {
19+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
20+
font-family: 'Tajawal';
21+
font-style: normal;
22+
font-weight: 500;
23+
src: url('../webfonts/tajawal/tajawal-v10-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
24+
}
25+
/* tajawal-700 - latin */
26+
@font-face {
27+
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
28+
font-family: 'Tajawal';
29+
font-style: normal;
30+
font-weight: 700;
31+
src: url('../webfonts/tajawal/tajawal-v10-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
32+
}

themes/docsy/static/js/bootstrap.min.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

themes/docsy/static/js/jquery.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

themes/docsy/static/js/lunr.min.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

themes/docsy/static/js/mermaid.min.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

themes/docsy/static/js/popper.min.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)