Registry / web-framework / oc-template-jade-compiler

oc-template-jade-compiler

JSON →
library7.5.0jsnpmunverified

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.

npm install oc-template-jade-compiler
INSTALL
IMPORT
SIG · OC-TEMPLATE-JADE-C
O
oc-template-jade-compiler
web-frameworkjavascriptv7.5.0
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.

compile
import { compile } from 'oc-template-jade-compiler'
const compile = require('oc-template-jade-compiler')
Package is ESM-only; CommonJS require will fail. Named export compile is the primary API.
JadeCompiler
import { JadeCompiler } from 'oc-template-jade-compiler'
TypeScript users can import the class type. Actual usage often uses the compile function directly.
default
import ocTemplateJadeCompiler from 'oc-template-jade-compiler'
import { default as ocTemplateJadeCompiler } from 'oc-template-jade-compiler'
Default export exists but is not documented; prefer named exports.

Compiles a Jade/Pug template string with locals and logs the rendered HTML.

import { compile } from 'oc-template-jade-compiler'; const template = 'h1 Hello #{name}'; const rendered = compile(template)({ name: 'World' }); console.log(rendered); // '<h1>Hello World</h1>'
oc --version
Debug
Known issues
breakingv7.0.0 dropped support for .jade extension by default; only .pug is compiled unless legacy mode enabled.
fix
Upgrade templates to .pug extension or configure legacy support.
affects: >=7.0.0 <8.0.0
deprecatedcompile function with callback signature is deprecated in favor of sync compile returning a function.
fix
Use compile(template)(locals) instead of compile(template, options, callback).
affects: >=7.0.0 <8.0.0
gotchaTypeScript types may be out of sync with actual exports; compile expects options object with 'filename' required for includes.
fix
Always pass { filename: String } in options even if empty.
affects: >=7.0.0
Errors
Common errors & fixes
Cannot find module 'pug'
Missing pug peer dependency.
fix
Install pug: npm install pug
TypeError: compile is not a function
Incorrect import – likely using default export instead of named export.
fix
Use named import: import { compile } from 'oc-template-jade-compiler'
ENOENT: no such file or directory, open '...'
The compile function requires a 'filename' option to resolve includes.
fix
Provide options object with filename: compile(template, { filename: '/path/to/template.jade' })
Upgrade
Version history
7.5.0latest on npm
Audit
Dependencies
pugrequiredCore dependency for compiling Jade/Pug templates into HTML
Agent activity
2 hits · last 30 days
node
2
Resources
oc-template-jade-compiler — npm install oc-template-jade-compiler · libregistry