glance icon indicating copy to clipboard operation
glance copied to clipboard

Added a config to load JavaScript similar to CSS with Cache Busting

Open ralphocdol opened this issue 8 months ago • 0 comments

See Issue https://github.com/glanceapp/glance/issues/550

Configuration

Single files are prioritized for backwards compatibility and familiarity with the existing custom-css-file

document:
  custom-js-file: /assets/single.js # defer and async are not possible
  custom-js-files: 
    - src: /assets/sample1.js
    - src: /assets/sample2.js
      defer: true # if async is also true, it will take precedence

theme:
  custom-css-file: /assets/single.css
  custom-css-files:
    - /assets/sample1.css
    - /assets/sample2.css

outputs:

<link rel="stylesheet" href="/assets/single.css?v=1743689171">
<script src="/assets/single.js?v=1743689171"></script>

Multiple

document:
  custom-js-files: 
    - src: /assets/sample1.js
    - src: /assets/sample2.js
      defer: true

theme:
  custom-css-files:
    - /assets/sample1.css
    - /assets/sample2.css

outputs:

<link rel="stylesheet" href="/assets/sample1.css?v=1743689355">
<link rel="stylesheet" href="/assets/sample2.css?v=1743689355">
<script src="/assets/sample1.js?v=1743689355"></script>
<script src="/assets/sample2.js?v=1743689355" defer=""></script>

ralphocdol avatar Apr 02 '25 16:04 ralphocdol