mirror of https://github.com/luizdepra/hugo-coder.git

Simon Pai
02.48.2021 1cdbe4f14a7ac93662ba45197a66be46164360be
Fix customJS and customCSS feature (#606)

* Fix customJS function

In the current state the customJS feature doesn't work, because an asset will only be generated to `/public` when `.RelPermalink` is used as mentioned in the [document](https://gohugo.io/hugo-pipes/introduction/#asset-publishing).

* Update CONTRIBUTORS.md

* Fix customCSS as well
2 files modified
17 ■■■■ changed files
CONTRIBUTORS.md 1 ●●●● patch | view | raw | blame | history
layouts/_default/baseof.html 16 ●●●● patch | view | raw | blame | history
CONTRIBUTORS.md
@@ -103,3 +103,4 @@
- [Kirill Feoktistov](https://feoktistoff.org)
- [leins275](https://github.com/LanskovNV)
- [Michael Weiss](https://mweiss.ch)
- [Simon Pai](https://github.com/simonpai)
layouts/_default/baseof.html
@@ -61,7 +61,13 @@
    {{ end }}
    {{ range .Site.Params.customCSS }}
      <link rel="stylesheet" href="{{ . | relURL }}" />
      {{ if $.Site.IsServer }}
        {{ $styles := resources.Get . }}
        <link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen">
      {{ else }}
        {{ $styles := resources.Get . | minify | fingerprint }}
        <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous" media="screen" />
      {{ end }}
    {{ end }}
    {{ range .Site.Params.customSCSS }}
@@ -123,7 +129,13 @@
    {{ end }}
    {{ range .Site.Params.customJS }}
      <script src="{{ . | relURL }}"></script>
      {{ if $.Site.IsServer }}
        {{ $script := resources.Get . }}
        <script src="{{ $script.RelPermalink }}"></script>
      {{ else }}
        {{ $script := resources.Get . | minify | fingerprint }}
        <script src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}"></script>
      {{ end }}
    {{ end }}
    {{ template "_internal/google_analytics.html" . }}