A compiler that converts Pug (formerly Jade) templates into React components by parsing Pug AST into intermediate JavaScript, converting to SpiderMonkey AST via Esprima, and producing React-compatible render functions. Current stable version is 1.1.0, with low release cadence (last update 2015). Key differentiators: supports `require` hoisting for external components, handles conditionals and iteration, but lacks filters, mixins, and cases. Not intended for production use; includes a CLI tool and works with CommonJS bundlers.
npm install pug-react-compilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: compile Pug to a React component and to a code string.
Migrate to a modern alternative like @emotion/styled or JSX with Babel.
Avoid these Pug features or process them manually before compilation.
Wrap multiple elements in a single parent element.
Prefer pug's `each` syntax over JavaScript for loops.
Wrap text nodes explicitly in a parent element to control output.
Ensure React is available globally or require it before using compiled components.
Run npm install pug --save alongside pug-react-compiler.
Use named imports: import { compile } from 'pug-react-compiler'