Skip to content

Commit

Permalink
Dynamically insert version numbers in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
imacrayon committed Aug 15, 2024
1 parent 5880a84 commit 7a67e4b
Show file tree
Hide file tree
Showing 5 changed files with 860 additions and 373 deletions.
4 changes: 3 additions & 1 deletion docs/eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const pluginBundle = require("@11ty/eleventy-plugin-bundle")
const pluginNavigation = require("@11ty/eleventy-navigation")
const esbuild = require('esbuild')
const postcss = require('postcss')
const lockFile = require('../package-lock.json')

module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy('css')
Expand Down Expand Up @@ -38,7 +39,8 @@ module.exports = function (eleventyConfig) {
]
})

eleventyConfig.addGlobalData('APLINE_AJAX_VERSION', () => process.env.npm_package_version)
eleventyConfig.addGlobalData('APLINE_VERSION', () => lockFile.packages['node_modules/alpinejs'].version)
eleventyConfig.addGlobalData('APLINE_AJAX_VERSION', () => lockFile.version)

eleventyConfig.addFilter('sort', (collection, path = '') => {
let keys = path.split('.')
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/creating-demos.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Use the mock server script included with Alpine AJAX when you need to build a qu
<!--
Include the typical required scripts before the mock server:
<script defer src="https://cdn.jsdelivr.net/npm/@imacrayon/alpine-ajax@{{ APLINE_AJAX_VERSION }}/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.11.1/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@{{ APLINE_VERSION }}/dist/cdn.min.js"></script>
-->
<script src="https://cdn.jsdelivr.net/npm/@imacrayon/alpine-ajax@{{ APLINE_AJAX_VERSION }}/dist/server.js"></script>

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Include the CDN build of Alpine AJAX as a `<script>` tag, just make sure to incl

```html
<script defer src="https://cdn.jsdelivr.net/npm/@imacrayon/alpine-ajax@{{ APLINE_AJAX_VERSION }}/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.11.1/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@{{ APLINE_VERSION }}/dist/cdn.min.js"></script>
```

### Via NPM
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/x-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ To enable the morph strategy, install the Morph Plugin **before** installing Alp
Via CDN:

```html
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/morph@3.x.x/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/morph@{{ APLINE_VERSION }}/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/@imacrayon/alpine-ajax@{{ APLINE_AJAX_VERSION }}/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.11.1/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@{{ APLINE_VERSION }}/dist/cdn.min.js"></script>

```

Expand Down
Loading

0 comments on commit 7a67e4b

Please sign in to comment.