0.1.3 • Published 7 months ago
nuxt-html-inject-commands v0.1.3
nuxt-html-inject-commands
Inject commands result into index.html meta tag.
Installation
# ✨ Auto-detect
npx nypm install -D nuxt-html-inject-commands
# npm
npm install -D nuxt-html-inject-commands
# yarn
yarn add -D nuxt-html-inject-commands
# pnpm
pnpm install -D nuxt-html-inject-commands
# bun
bun install -D nuxt-html-inject-commands
# deno
deno install --dev nuxt-html-inject-commands
Usage
// vite.config.ts
export default defineNuxtConfig({
modules: ['nuxt-html-inject-commands'],
htmlInjectCommands: {
commands: [
{
name: 'git:commit',
command: 'git log -1 --format="hash=%h, date=%aI"',
errorMsg: 'Failed to get git commit hash',
},
{
name: 'error:withmsg',
command: 'exit 1',
errorMsg: 'Failed to execute error command',
},
{
name: 'error:withoutmsg',
command: 'exit 1',
},
],
},
})
Type Declarations
export interface Options {
/**
* List of commands to be executed
*/
commands: Command[]
}
export interface Command {
/**
* Which will be used to name attribute of the meta tag
*/
name: string
/**
* Command to be executed
* The result of the command will be injected into content attribute of the meta tag
*/
command: string
/**
* Replease the content of the meta tag when the command fails
*/
errorMsg?: string
}
Contribution
- Clone this repository
- Install the latest LTS version of Node.js
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
- Run tests using
pnpm dev
orpnpm test
License
Published under the MIT license. Made by @byronogis and community 💛
🤖 auto updated with automd (last updated: Mon Dec 30 2024)