Skip to content

Commit

Permalink
feat: local JS script is prefered, unless the decap_cms.js_url is spe…
Browse files Browse the repository at this point in the history
…cified
  • Loading branch information
razonyang committed Jan 23, 2024
1 parent 554467f commit 501bf90
Show file tree
Hide file tree
Showing 8 changed files with 9,086 additions and 2,344 deletions.
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/*.tmpl.scss
assets/decap-cms/scss/_custom.scss
491 changes: 491 additions & 0 deletions assets/decap-cms/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/decap-cms/index.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*! For license information please see decap-cms.js.LICENSE.txt */
2 changes: 1 addition & 1 deletion layouts/_default/decap-cms.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{ partialCached "decap-cms/hooks/head-end" . }}
</head>
<body>
<script src="{{ default `https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js` site.Params.decap_cms.js_url }}"></script>
{{ partialCached "decap-cms/script" . }}
{{ partialCached "decap-cms/init" . }}
{{ partialCached "decap-cms/hooks/body-end" . }}
</body>
Expand Down
10 changes: 10 additions & 0 deletions layouts/partials/decap-cms/script.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- with site.Params.decap_cms.js_url }}
<script src="{{ . }}"></script>
{{- else }}
{{- $js := resources.Get "decap-cms/index.js" }}
{{- $js = slice $js | resources.Concat "js/decap-cms.js" }}
{{- if hugo.IsProduction }}
{{- $js = $js | fingerprint }}
{{- end }}
<script src="{{ $js.RelPermalink }}"></script>
{{- end }}
Loading

0 comments on commit 501bf90

Please sign in to comment.