Gathering detailed insights and metrics for vite-manifest-parser
Gathering detailed insights and metrics for vite-manifest-parser
npm install vite-manifest-parser
Typescript
Module System
Node Version
NPM Version
TypeScript (83.97%)
JavaScript (16.03%)
Total Downloads
2,318
Last Day
2
Last Week
190
Last Month
299
Last Year
2,318
13 Stars
4 Commits
1 Forks
1 Watching
1 Branches
1 Contributors
Latest Version
1.0.1
Package Id
vite-manifest-parser@1.0.1
Unpacked Size
13.28 kB
Size
3.53 kB
File Count
5
NPM Version
6.14.17
Node Version
16.14.2
Publised On
16 Jan 2024
Cumulative downloads
Total Downloads
Last day
-77.8%
2
Compared to previous day
Last week
413.5%
190
Compared to previous week
Last month
-69.7%
299
Compared to previous month
Last year
0%
2,318
Compared to previous year
This library provides a simple way to parse a manifest.json
file generated by Vite and render corresponding HTML code blocks for easy backend integration. It is particularly useful for projects where the frontend is managed by Vite and the backend requires integration of the generated assets.
manifest.json
to generate HTML script and link tags.To install vite-manifest-parser
, run the following command:
1npm install vite-manifest-parser --save
To use the parser, you need to import the parser
function from the package and call it with the appropriate parameters.
1import { parser } from 'vite-manifest-parser'; 2 3const input = 'src/app/main.ts'; // Your entry file 4const outDir = '/absolute/path/to/dist'; // Your build directory 5const publicPath = '/public/dist/'; // Public path to your assets 6const isDev = process.env.NODE_ENV !== 'production'; // Determine the environment 7 8const { preload, css, js } = await parser({ input, outDir, publicPath, isDev }); 9
For template usage, such as rendering with EJS templates.
1<!DOCTYPE html> 2<html> 3 <head> 4 <title>vite-manifest-parser</title> 5 <%-preload%> 6 <%-css%> 7 </head> 8 <body> 9 <div id="app"></div> 10 <%-js%> 11 </body> 12</html>
parser(options)
options.input
- The entry file, which is the relative path in the client project (the key value in the manifest.json).options.outDir
- The build directory, please use an absolute path.options.publicPath
- The resource path, such as /public/dist/ or https://static.example.com/. The default value is '/'.options.isDev
- Indicates whether it is a development environment. If true, it will not parse manifest.json and will use Vite's development server.To contribute to the library or run it locally for development, you will need to clone the repository and install its dependencies.
1git clone https://github.com/your-username/vite-manifest-parser.git 2cd vite-manifest-parser 3pnpm install
Make sure to write tests for new features or bug fixes and run the tests to ensure everything is working correctly.
1npm test
This project is licensed under the MIT License - see the LICENSE file for details.
No vulnerabilities found.
No security vulnerabilities found.