0.0.2 • Published 2 years ago

vite-plugin-logs v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vite-plugin-logs

NPM version

A vite plugin for html inject logs

Install

npm install vite-plugin-logs D

Usage

import { defineConfig } from 'vite'

import logs, { preset } from 'vite-plugin-logs'

export default defineConfig(({ mode }) => {
  return {
    plugins: [
      logs(
        preset([
          { type: 'darkblue:gray', label: '..', value: '{_name_}' },
          { type: 'darkblue:green', label: '..', value: mode },
          { type: 'darkblue:blue', label: '..', value: '{_version_}' },
          { type: 'darkblue:blue', label: '..', value: '{_time_}' },
        ])
      ),
    ]
  }
})

Custom

import { defineConfig } from 'vite'

export default defineConfig(({ mode }) => {
  return {
    plugins: [
      logs([
        [
          { text: 'Project', style: {/* ... */} },
          { text: ' {_NAME_} ', style: {/* ... */} },
        ],
        [
          { text: 'Environment', style: {/* ... */} },
          { text: ` ${mode} `, style: {/* ... */} },
        ],
        // ....
      ]),
    ]
  }
})

License

MIT License © 2023 Hairyf

0.0.2

2 years ago

0.0.1

2 years ago