vite-plugin-temp-file
v1.0.0
Published
Adds a temporary file to your project when running the Vite server
Downloads
4
Maintainers
Readme
Vite Plugin Temporary File
Adds a temporary file to your project when running a Vite server.
How to install
Install the plugin as a dev dependency:
npm install --save-dev vite-plugin-temp-fileHow to setup
Update your vite.config.js file with the following:
import { defineConfig } from 'vite'
import tempFile from 'vite-plugin-temp-file'
export default defineConfig({
plugins: [
tempFile(),
]
})By default it will create a blank text file .vite-server in the same folder as the configuration file.
How to configure
The plugin receives a single object argument with 2 parameters:
- fileName
- content
It can be updated to change the file path, name, and contents:
tempFile({
fileName: './path/to/.vite-running',
content: 'This file indicates that the vite server is running',
})This will move the text file to /path/to/ and rename it to .vite-running with the content inserted.
Recommendations
It is recommended to gitignore this temporary text file.
