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
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
66 Stars
51 Commits
5 Forks
3 Watching
1 Branches
3 Contributors
Updated on 11 Sept 2024
TypeScript (100%)
Cumulative downloads
Total Downloads
Last day
-18.5%
17,789
Compared to previous day
Last week
-1.7%
99,058
Compared to previous week
Last month
23.6%
439,350
Compared to previous month
Last year
202.3%
7,679,747
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
8 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/26 approved changesets -- 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
Score
Last Scanned on 2024-11-18
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