1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 17:45:31 -04:00

create inline-svg partial function

[skip ci]
This commit is contained in:
2020-05-14 13:36:27 -04:00
parent 59a92fc60e
commit 24edb85379
7 changed files with 7 additions and 22 deletions

View File

@@ -7,6 +7,5 @@
"browser": true, "browser": true,
"es6": true "es6": true
}, },
"rules": { "rules": {}
}
} }

View File

@@ -7,8 +7,6 @@
"preset": "lighthouse:no-pwa", "preset": "lighthouse:no-pwa",
"assertions": { "assertions": {
"color-contrast": "warn", "color-contrast": "warn",
"errors-in-console": "warn",
"frame-title": "warn",
"link-text": "warn", "link-text": "warn",
"total-byte-weight": ["warn", {"minScore": 0.9}], "total-byte-weight": ["warn", {"minScore": 0.9}],
"unminified-javascript": "warn", "unminified-javascript": "warn",

View File

@@ -3,16 +3,11 @@
"code-block-style": { "style": "fenced" }, "code-block-style": { "style": "fenced" },
"code-fence-style": { "style": "backtick" }, "code-fence-style": { "style": "backtick" },
"fenced-code-language": true, "fenced-code-language": true,
"heading-increment": false,
"heading-style": { "style": "atx" }, "heading-style": { "style": "atx" },
"hr-style": { "style": "---" }, "hr-style": { "style": "---" },
"line-length": false, "line-length": false,
"no-bare-urls": false,
"no-blanks-blockquote": true,
"no-empty-links": false, "no-empty-links": false,
"no-hard-tabs": false, "no-inline-html": { "allowed_elements": [ "p", "a", "strong", "em", "img", "svg", "path", "polygon", "circle", "g", "code", "span", "sup", "figure", "figcaption", "iframe" ] },
"no-inline-html": { "allowed_elements": [ "p", "a", "strong", "em", "img", "svg", "path", "polygon", "circle", "g", "h2", "h3", "code", "span", "sup", "figure", "figcaption", "iframe" ] },
"no-multiple-blanks": false,
"no-trailing-punctuation": false, "no-trailing-punctuation": false,
"single-h1": false, "single-h1": false,
"whitespace": false "whitespace": false

View File

@@ -6,20 +6,12 @@
"plugins": ["stylelint-prettier"], "plugins": ["stylelint-prettier"],
"rules": { "rules": {
"color-hex-length": "long", "color-hex-length": "long",
"function-parentheses-space-inside": null,
"function-url-quotes": null, "function-url-quotes": null,
"indentation": [ 2, { "severity": "warning" } ],
"max-nesting-depth": 6, "max-nesting-depth": 6,
"number-no-trailing-zeros": null,
"order/properties-alphabetical-order": null, "order/properties-alphabetical-order": null,
"rule-empty-line-before": null,
"scss/dollar-variable-colon-space-after": null,
"selector-list-comma-newline-after": null,
"selector-max-compound-selectors": null, "selector-max-compound-selectors": null,
"selector-max-id": null, "selector-max-id": null,
"selector-no-qualifying-type": null, "selector-no-qualifying-type": null,
"selector-pseudo-element-no-unknown": [ true, { "ignorePseudoElements": [ "cue" ] } ], "shorthand-property-no-redundant-values": null
"shorthand-property-no-redundant-values": null,
"string-quotes": [ "double", { "severity": "warning" } ]
} }
} }

View File

@@ -250,7 +250,7 @@
<header> <header>
<nav> <nav>
<a id="logo" href="{{ .Site.BaseURL }}" title="{{ .Site.Title }}"> <a id="logo" href="{{ .Site.BaseURL }}" title="{{ .Site.Title }}">
{{ partial "svg/logo.svg" (dict "width" 30 "height" 45) }} {{ partial "functions/inline-svg" (dict "src" "img/logo.svg" "width" 30 "height" 45) }}
<span id="name">{{ .Site.Title }}</span> <span id="name">{{ .Site.Title }}</span>
</a> </a>

View File

@@ -1,4 +1,4 @@
{{ $svg := resources.Get "img/logo.svg" -}} {{ $svg := resources.Get .src -}}
{{ $html := $svg.Content -}} {{ $html := $svg.Content -}}
{{/* remove unneeded tags/attributes when SVG is inlined versus a .svg file */}} {{/* remove unneeded tags/attributes when SVG is inlined versus a .svg file */}}
@@ -10,5 +10,6 @@
{{ $html = replace $html "<svg" $wxh -}} {{ $html = replace $html "<svg" $wxh -}}
{{/* bit of a hack: calling .Permalink so that the SVG file is published too */}}
{{ printf "<!-- auto-inlined from: %s -->" $svg.Permalink | safeHTML }} {{ printf "<!-- auto-inlined from: %s -->" $svg.Permalink | safeHTML }}
{{ $html | safeHTML -}} {{ $html | safeHTML -}}

View File

@@ -1,7 +1,7 @@
<header> <header>
<nav> <nav>
<a class="no-underline" href="{{ .Site.BaseURL }}" id="logo" rel="me author" aria-label="{{ .Site.Title }}"> <a class="no-underline" href="{{ .Site.BaseURL }}" id="logo" rel="me author" aria-label="{{ .Site.Title }}">
{{ partial "svg/logo.svg" (dict "width" 28 "height" 40) }} {{ partial "functions/inline-svg" (dict "src" "img/logo.svg" "width" 28 "height" 40) }}
<h1 id="name">{{ .Site.Title }}</h1> <h1 id="name">{{ .Site.Title }}</h1>
</a> </a>
<ul> <ul>