chore: use app version to populate version query params
This commit is contained in:
parent
631a50f7bd
commit
b4a2655d0a
3 changed files with 11 additions and 5 deletions
|
@ -23,6 +23,12 @@ import { execSync } from 'child_process'
|
|||
import dotenvFlow from 'dotenv-flow'
|
||||
dotenvFlow.config()
|
||||
|
||||
// get app version
|
||||
import { createRequire } from 'module'
|
||||
|
||||
const require = createRequire(import.meta.url)
|
||||
const appVersion = require('./package.json').version
|
||||
|
||||
/**
|
||||
* @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig
|
||||
*/
|
||||
|
@ -104,7 +110,7 @@ export default async function (eleventyConfig) {
|
|||
|
||||
// shortcodes
|
||||
eleventyConfig.addShortcode('image', img)
|
||||
eleventyConfig.addShortcode('assetHash', () => Math.random())
|
||||
eleventyConfig.addShortcode('appVersion', () => appVersion)
|
||||
|
||||
// transforms
|
||||
eleventyConfig.addTransform('html-minify', (content, path) => {
|
||||
|
|
Reference in a new issue