GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing ejs.co — EJS -- Embedded JavaScript templates Generate HTML with plain JS.No new syntax, no special directives. Write the JavaScript you already know, right inside your HTML. 40M+ Weekly downloads 8.1k GitHub stars 0 Dependencies $ npm install ejs What is EJS?What is the "E" for? "Embedded?" Could be. How about "Effective," "Elegant," or just "Easy"? EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. No religiousness about how to organize things. No reinvention of iteration and control-flow. Use plain JavaScriptAll templating languages grow to be Turing-complete. Just cut out the middle-man and use the JavaScript you already know.
Fast developmentDon't waste time figuring out arcane new syntax or how to preprocess your data so it renders right.
Simple syntaxJavaScript code in simple scriptlet tags. Just write JS that emits the HTML you want.
Speedy executionTemplating that never shows up in your performance budget. Fast enough you can forget it's there.
Easy debuggingWhen something breaks, you're not stuck deciphering a black box. Debug it like any other JavaScript.
Active developmentLarge community, active maintainers. We're happy to answer questions or give help.
A note for security professionalsBefore reporting any security issues, please reference the SECURITY.md for this project.
If you give end-users unfettered access to the EJS render method, you are using EJS in an inherently un-secure way. EJS is effectively a JavaScript runtime. If you run the render method without checking inputs yourself, you are responsible for the results. In short, do not submit vulnerabilities that include this snippet:
app.get('/', (req, res) => {
res.render('index', req.query); }); Zero new concepts.Other templating languages invent their own dialect for loops, conditionals, and partials. EJS just uses JavaScript. No new keywords or helper APIs to learn. Handlebars
{{#if user.loggedIn}}
Hello, {{user.name}}! {{else}} Hello, Guest! {{/if}} Pug
if user.loggedIn
| Hello, #{user.name}! else | Hello, Guest! Mustache
{{#user.loggedIn}}
Hello, {{user.name}}! {{/user.loggedIn}} {{^user.loggedIn}} Hello, Guest! {{/user.loggedIn}} <% EJS %>
<% if (user.loggedIn) { %>
Hello, <%= user.name %>! <% } else { %> Hello, Guest! <% } %>
Up and running in minutes.Install EJS, pick your module system, and start generating HTML with plain JavaScript. Install via npmAdd EJS to your project with a single command. $ npm install ejs ESM or CJSPick the module system that fits your project. import ejs from 'ejs';
const ejs = require('ejs');
Render a templatePass EJS a template string and some data. You've got HTML. render.js import ejs from 'ejs'; let people = ['geddy', 'neil', 'alex']; let html = ejs.render('<%= people.join(", "); %>', {people}); Use the command lineFeed it a template file and a data file, specify an output file. $ ejs ./template.ejs -f data.json -o ./output.html Browser supportDownload a browser build and drop it in a script tag. index.html <script src="ejs.js"></script> <script> let html = ejs.render('<%= people.join(", "); %>', {people}); </script> Need help?Ready to build?Read the Docs → |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |