
Security News
MCP Steering Committee Launches Official MCP Registry in Preview
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
vite-manifest-parser
Advanced tools
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 requi
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:
npm 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.
import { parser } from 'vite-manifest-parser';
const input = 'src/app/main.ts'; // Your entry file
const outDir = '/absolute/path/to/dist'; // Your build directory
const publicPath = '/public/dist/'; // Public path to your assets
const isDev = process.env.NODE_ENV !== 'production'; // Determine the environment
const { preload, css, js } = await parser({ input, outDir, publicPath, isDev });
For template usage, such as rendering with EJS templates.
<!DOCTYPE html>
<html>
<head>
<title>vite-manifest-parser</title>
<%-preload%>
<%-css%>
</head>
<body>
<div id="app"></div>
<%-js%>
</body>
</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.
git clone https://github.com/your-username/vite-manifest-parser.git
cd vite-manifest-parser
pnpm install
Make sure to write tests for new features or bug fixes and run the tests to ensure everything is working correctly.
npm test
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
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 requi
We found that vite-manifest-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.