Registry / web-framework / remixml

remixml

JSON →
library7.0.11jsnpmunverified

Remixml is an XML/HTML-like macro language and template compiler engine for JavaScript, currently at v7.0.11. It compiles templates directly into minified JavaScript with zero runtime dependencies, supports auto-escaping, asynchronous control, user-defined tags, filters, and whitespace preservation. Unlike many templating engines, Remixml uses XML entities (e.g., &scope.varname;) instead of artificial delimiters, integrates smoothly with existing XHTML/HTML syntax highlighting, and includes a validating XHTML parser. It runs in Node.js (ES2018+) and modern browsers, with a runtime size under 7 KB gzipped.

npm install remixml
INSTALL
IMPORT
SIG · REMIXML
R
remixml
web-frameworkjavascriptv7.0.11
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Remixml
import Remixml from 'remixml'
const Remixml = require('remixml')
ESM default import; CJS require() works but no named exports available.
parse2txt
import Remixml from 'remixml'; Remixml.parse2txt(template, data)
import { parse2txt } from 'remixml'
parse2txt is a method on the default export, not a named export.
compile
import Remixml from 'remixml'; const compiled = Remixml.compile(template)
const { compile } = require('remixml')
compile is a method on the default export. For CJS: const Remixml = require('remixml'); Remixml.compile(...).

Demonstrates basic Remixml usage: parsing a template with variable substitution and a loop.

import Remixml from 'remixml'; const data = { _: { sitename: 'Example', description: 'quick start' }, var: { items: ['foo', 'bar', 'baz'] } }; const template = ` <h1>&_.sitename; - &_.description;</h1> <ul><for list="&var.items;"> <li>&_._value;</li> </for></ul> `; const output = Remixml.parse2txt(template, data); console.log(output); // <h1>Example - quick start</h1> // <ul> // <li>foo</li> // <li>bar</li> // <li>baz</li> // </ul>
Debug
Known issues
gotchaVariable names must contain at least one dot (e.g., &scope.varname;). Plain ampersand entities like &varname; are treated as HTML entities, not Remixml variables.
fix
Use &scope.varname; syntax for all template variables.
affects: >=1.0
gotchaIn <for list="...">, the list value must be a string expression resolving to an array; objects are not directly iterable with <for>.
fix
Use <for list="&var.items;"> where items is an array. For objects, use RXML library or custom tag.
affects: >=1.0
deprecatedThe official documentation suggests using entities like &var.arrays.1; for array indexing, but this is fragile and not recommended.
fix
Use <set> and <for> loops to access array elements or pass them as data properties.
affects: >=1.0
breakingIn v7, the default export changed from a constructor to a plain object with static methods. Old code using 'new Remixml()' will break.
fix
Use import Remixml from 'remixml' and call Remixml.parse2txt() directly; do not instantiate.
affects: >=7.0.0
gotchaRemixml does not escape HTML in variable values by default; you must explicitly use autoescape filters or entity encoding.
fix
Use <autoescape>on</autoescape> or apply filters to variables: &escape.htmlescape(var.foo);
affects: >=1.0
Errors
Common errors & fixes
Uncaught TypeError: Remixml is not a constructor
Attempting to instantiate Remixml with 'new Remixml()' in v7+.
fix
Use static methods: import Remixml from 'remixml'; Remixml.parse2txt(...);
Error: Entity '._.sitename' not found
Variable name does not start with a valid scope prefix (e.g., '_', 'var', 'anything') or data object is missing the scope.
fix
Ensure data object has the scope as a nested object: { _: { sitename: 'value' } }
Error: Missing closing tag for '<for>'
The <for> tag requires a </for> closing tag. Remixml is strict about well-formed XML/XHTML.
fix
Add </for> or self-close the tag if using a different form.
Upgrade
Version history
7.0.11latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
remixml — npm install remixml · libregistry