BEMHTML Compat

raw JSON →
0.1.2 verified Fri May 01 auth: no javascript abandoned

A transpiler that converts legacy BEMHTML source code (pre-2013 syntax) into modern JavaScript-compatible code for BEM frameworks. Current stable version is 0.1.2, with no active development since 2014. It is a specialized tool for migrating BEMHTML templates from the old declarative format to the new functional style using `match()` calls. Its key differentiator is handling the syntax shift in BEM libraries, but it has been superseded by direct development on BEMHTML and is no longer maintained.

error Error: Cannot find module 'bemhtml-compat'
cause Package not installed or removed from npm? It still exists but is not maintained.
fix
Run 'npm install bemhtml-compat' (version 0.1.2). If that fails, the package may have been unpublished.
gotcha Package is no longer maintained and has been abandoned since 2014. No compatibility with modern Node.js versions beyond v0.10.
fix Use the built-in BEMHTML transpilation features in the 'bem' package or write templates directly in modern BEMHTML syntax.
npm install bemhtml-compat
yarn add bemhtml-compat
pnpm add bemhtml-compat

Transpiles an old-style BEMHTML block declaration to modern JavaScript.

import bemcompat from 'bemhtml-compat';
const result = bemcompat.transpile('block b1, tag: "a"');
console.log(result); // match(this.block === 'b1', this._mode === 'tag')('a');