EJS (Embedded JavaScript) is a mature, widely-used templating library for Node.js and browsers. It compiles template strings (using `<% %>` tags) into JavaScript functions for server-side or client-side rendering. The core API provides `compile`, `render`, and `renderFile` methods, with support for includes, custom delimiters, caching, async rendering, and Express integration. The library is dual-published as CommonJS and ES Modules, and ships with a CLI tool for rendering templates from the command line. The codebase is well-engineered with a clean separation of concerns: `lib/esm/ejs.js` contains the main template engine, `lib/esm/utils.js` provides helper functions (including prototype-pollution-hardened shallow copy and XML escaping), and `lib/esm/parseargs.js` is a reusable CLI argument parser that was extracted to replace a Jake dependency. The build pipeline uses TypeScript to compile ESM to CJS, browserify for the browser bundle, and uglify-js for minification. Tests are comprehensive (Mocha) and include unit tests for the argument parser, prototype pollution resistance, and ecosystem compatibility with bundlers like Rollup, Webpack, Vite, and Deno. The library demonstrates strong engineering practices: it explicitly avoids prototype pollution by using null-prototype objects, validates option names to prevent code injection, and supports strict mode and destructured locals as alternatives to the deprecated `with` statement. The CLI parser is a pure, well-tested module that handles edge cases like attached short values, grouped booleans, error collection, and prototype-safe option names. While the core engine uses `new Function` (standard for JS template engines) and defaults to `with`, these are documented trade-offs with opt-out flags. Overall, EJS is a solid, professionally maintained project with a clean architecture and high reusability of its utility modules.
html-bundler-webpack-plugin is a webpack plugin that processes HTML templates and bundles associated assets (CSS, JS, images, etc.) into output HTML files. It treats HTML as a webpack entry point, resolves dependencies via webpack's module system, and updates asset references to hashed output URLs. The plugin supports multiple template engines (Pug, Handlebars, EJS, Nunjucks, etc.), asset inlining, subresource integrity, hot module replacement, and code splitting. Architecture consists of a main plugin class, loader infrastructure, and modular preprocessors. It integrates with webpack's compilation hooks for asset extraction and HTML modification. Examples demonstrate usage with frameworks like React, Vue, and CSS tools like TailwindCSS.
PocketPages is a server-side page rendering framework for PocketBase, enabling developers to build multi-page applications (MPAs) using file-based routing, EJS templating, and a plugin system. The core framework handles route resolution, middleware execution, layout rendering, and asset fingerprinting. It includes a rich plugin ecosystem for authentication (password, OTP, OAuth2, anonymous), realtime SSE updates, Markdown processing, and Datastar integration. The monorepo also provides starter kits (minimal, auth, daisyui, htmx, datastar) and a documentation site built with the framework itself. In production, it runs as a PocketBase hook, intercepting HTTP requests and rendering pages from the `pb_hooks/pages/` directory with full access to the PocketBase JSVM API.