{"id":26032,"library":"oc-template-jade-compiler","title":"OC Jade Template Compiler","description":"Compiler module for OC (OpenComponents) that compiles Jade/Pug templates used by oc-template-jade components. Version 7.5.0 is the latest stable release with intermittent updates. Key differentiators: provides legacy support for both .jade and .pug files; part of the OC micro-frontends ecosystem; ships TypeScript types for safer integration. Known for version mismatches with OC core and template runtime packages.","status":"active","version":"7.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/opencomponents/base-templates","tags":["javascript","oc","opencomponents","typescript"],"install":[{"cmd":"npm install oc-template-jade-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add oc-template-jade-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add oc-template-jade-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for compiling Jade/Pug templates into HTML","package":"pug","optional":false}],"imports":[{"note":"Package is ESM-only; CommonJS require will fail. Named export compile is the primary API.","wrong":"const compile = require('oc-template-jade-compiler')","symbol":"compile","correct":"import { compile } from 'oc-template-jade-compiler'"},{"note":"TypeScript users can import the class type. Actual usage often uses the compile function directly.","wrong":"","symbol":"JadeCompiler","correct":"import { JadeCompiler } from 'oc-template-jade-compiler'"},{"note":"Default export exists but is not documented; prefer named exports.","wrong":"import { default as ocTemplateJadeCompiler } from 'oc-template-jade-compiler'","symbol":"default","correct":"import ocTemplateJadeCompiler from 'oc-template-jade-compiler'"}],"quickstart":{"code":"import { compile } from 'oc-template-jade-compiler';\nconst template = 'h1 Hello #{name}';\nconst rendered = compile(template)({ name: 'World' });\nconsole.log(rendered); // '<h1>Hello World</h1>'","lang":"typescript","description":"Compiles a Jade/Pug template string with locals and logs the rendered HTML."},"warnings":[{"fix":"Upgrade templates to .pug extension or configure legacy support.","message":"v7.0.0 dropped support for .jade extension by default; only .pug is compiled unless legacy mode enabled.","severity":"breaking","affected_versions":">=7.0.0 <8.0.0"},{"fix":"Use compile(template)(locals) instead of compile(template, options, callback).","message":"compile function with callback signature is deprecated in favor of sync compile returning a function.","severity":"deprecated","affected_versions":">=7.0.0 <8.0.0"},{"fix":"Always pass { filename: String } in options even if empty.","message":"TypeScript types may be out of sync with actual exports; compile expects options object with 'filename' required for includes.","severity":"gotcha","affected_versions":">=7.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install pug: npm install pug","cause":"Missing pug peer dependency.","error":"Cannot find module 'pug'"},{"fix":"Use named import: import { compile } from 'oc-template-jade-compiler'","cause":"Incorrect import – likely using default export instead of named export.","error":"TypeError: compile is not a function"},{"fix":"Provide options object with filename: compile(template, { filename: '/path/to/template.jade' })","cause":"The compile function requires a 'filename' option to resolve includes.","error":"ENOENT: no such file or directory, open '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}