Skip to content

Instantly share code, notes, and snippets.

@0x1eef
0x1eef / ejs.ts
Created April 24, 2023 19:31
EJS vite plugin
import { PluginOption } from "vite";
import { render } from 'ejs';
import path from 'path';
import fs from 'fs';
type ReadFile = [string, object];
const readFile = async (...args: ReadFile) => {
const [path, options] = args;
return new Promise((resolve, reject) => {
fs.readFile(path, options, (err, data) => {