Nxpress LogoNxpressv1.3.8
07

Built-in Template Helpers

Nxpress registers built-in helper functions accessible in all supported template engines (ejs, hbs, nunjucks, liquid).

Formatting & String Helpers

HelperDescription
str(val)Converts value or object to string (JSON.stringify for objects).
json(val)Parses a JSON string into an object.
lower(val)Converts string to lowercase.
upper(val)Converts string to uppercase.
capitalize(val)Capitalizes the first letter of string.
truncate(val, len)Truncates string to specified length (default 50) with ...
join(arr, sep)Joins array elements into a string using separator (default ", ").

Comparisons & Logic Helpers

HelperDescription
eq(a, b)Returns true if a === b.
ne(a, b)Returns true if a !== b.
gt(a, b) / gte(a, b)Greater than / Greater than or equal.
lt(a, b) / lte(a, b)Less than / Less than or equal.
and(...args)Returns true if all arguments are truthy.
or(...args)Returns true if any argument is truthy.
not(val)Returns logical NOT (!val).
ternary(cond, trueVal, falseVal)Returns trueVal if cond is truthy, otherwise falseVal.

Lucide Icon Helpers (icon / I)

Renders zero-dependency server-side Lucide SVG icons by name. Supports kebab-case, camelCase, or PascalCase.

Lucide Icons in EJS
<%- icon('user', 'w-5 h-5 text-sky-500') %>
<%- I('moon', 'w-5 h-5 dark:hidden') %>
<%- I('sun', 'w-5 h-5 hidden dark:block') %>

Zero-Config Head Injections (SEO & Tailwind CSS)

Nxpress automatically compiles Tailwind CSS and renders companion file metadata (<title>, <meta>, OpenGraph, Twitter), and injects them directly before </head> in your layouts. No template variables are needed.

Clean Layout with Automatic Injections



  
  
  


  <%- body %>

Collections & Utility Helpers

HelperDescription
cn(...classes)Merges class names and resolves Tailwind CSS conflicts using clsx and tailwind-merge.
tr(key, [params])Returns translated text dictionary string with variable interpolation.
len(val)Returns length of array, string, or object keys count.
contains(arr, val) / includes(arr, val)Checks if array or string contains value.
add(a, b) / sub(a, b)Adds or subtracts two numbers.