Gathering detailed insights and metrics for vite-plugin-ejs
Gathering detailed insights and metrics for vite-plugin-ejs
Gathering detailed insights and metrics for vite-plugin-ejs
Gathering detailed insights and metrics for vite-plugin-ejs
npm install vite-plugin-ejs
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
67 Stars
51 Commits
5 Forks
2 Watchers
1 Branches
3 Contributors
Updated on Mar 28, 2025
Latest Version
1.7.0
Package Id
vite-plugin-ejs@1.7.0
Unpacked Size
6.56 kB
Size
2.63 kB
File Count
5
NPM Version
9.5.0
Node Version
18.15.0
Published on
Nov 16, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Use ejs template language in your entrypoint i.e index.html
Note: For Vite version < 5
use v1.6.4
of this plugin.
1npm i vite-plugin-ejs 2# or 3yarn add vite-plugin-ejs
File: vite.config.js
1import {defineConfig} from "vite"; 2import {ViteEjsPlugin} from "vite-plugin-ejs"; 3 4export default defineConfig({ 5 plugins: [ 6 // Without Data 7 ViteEjsPlugin(), 8 9 // With Data 10 ViteEjsPlugin({ 11 domain: "example.com", 12 title: "My vue project!" 13 }), 14 15 // Or With Vite Config 16 ViteEjsPlugin((viteConfig) => { 17 // viteConfig is the current viteResolved config. 18 return { 19 root: viteConfig.root, 20 domain: "example.com", 21 title: "My vue project!" 22 } 23 }), 24 ], 25});
File: index.html
1<!DOCTYPE html> 2<html lang="en"> 3<head> 4 <meta charset="UTF-8"/> 5 <link rel="icon" href="/favicon.ico"/> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"/> 7 <title><%= domain %> | <%= title %></title> 8 9 <!-- Run Conditions--> 10 <% if(isDev){ %> 11 <script src="/path/to/development-only-script.js"></script> 12 <% } else { %> 13 <script src="/path/to/production-only-script.js" crossorigin="anonymous"></script> 14 <% } %> 15</head> 16<body> 17<div id="app"></div> 18<script type="module" src="/src/main.ts"></script> 19</body> 20</html>
Note: isDev
is included in your data by default
The object below is the default data of the render function.
1return { 2 NODE_ENV: config.mode, 3 isDev: config.mode === "development" 4}
You can configure ejs by passing an object to the plugin.
1export default defineConfig({ 2 plugins: [ 3 ViteEjsPlugin( 4 {title: 'My vue project!'}, 5 { 6 ejs: { 7 // ejs options goes here. 8 beautify: true, 9 }, 10 } 11 ), 12 ], 13});
If you want to use viteconfig
to configure ejs, you can pass a function to the plugin, the function will receive the
current vite config as the first argument.
1export default defineConfig({ 2 plugins: [ 3 ViteEjsPlugin( 4 {title: 'My vue project!'}, 5 { 6 ejs: (viteConfig) => ({ 7 // ejs options goes here. 8 views: [viteConfig.publicDir] 9 }) 10 } 11 ), 12 ], 13});
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 2/26 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
17 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More