Registry / devops / browserify-hogan

browserify-hogan

JSON →
library0.3.0jsnpmunverified

browserify-hogan is a Browserify transform plugin for precompiling Hogan.js Mustache templates at build time. Version 0.3.0 supports file extensions .ms, .mustache, .hogan, .hg, and .html, and includes an optional minification step via html-minifier. It integrates seamlessly with Browserify's transform pipeline, allowing templates to be required like regular modules. The package is stable but receives infrequent updates; no releases since 2014. Alternative: hoganify offers similar functionality.

npm install browserify-hogan
INSTALL
IMPORT
SIG · BROWSERIFY-HOGAN
B
browserify-hogan
devopsjavascriptv0.3.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.

browserify-hogan
const hoganify = require('browserify-hogan')
This is a transform plugin, not a standard module import. Used via Browserify's transform option.
template (via require)
const template = require('./template.ms')
const template = require('./template.ms').default
The precompiled template exports a function directly, not a module with default export.
Template render
const html = template.render({foo: 'bar'})
template({foo: 'bar'})
The precompiled template has a .render() method, not callable directly.

Demonstrates installing and using browserify-hogan to precompile a Mustache template, require it, render with data, and build into a bundle.

// Install dependencies npm install hogan.js browserify-hogan --save // Create a template file: template.ms // Content: <h1>{{title}}</h1> // Create index.js const template = require('./template.ms'); const html = template.render({title: 'Hello World'}); console.log(html); // Build with Browserify CLI // npx browserify -t browserify-hogan index.js -o bundle.js // Run bundle // node bundle.js // Outputs: <h1>Hello World</h1>
Debug
Known issues
deprecatedPackage has not been updated since 2014 and relies on older versions of Browserify and Hogan.js. May not work with modern tooling.
fix
Consider using hoganify or migrate to a more modern template system like Handlebars with Webpack/Rollup.
affects: >=0.0.1
gotchaThe transform must be applied at build time; templates cannot be required dynamically.
fix
Use static require statements for templates to ensure they are precompiled.
affects: *
gotchaRequires hogan.js to be installed as a separate dependency.
fix
Run npm install hogan.js --save alongside browserify-hogan.
affects: *
Errors
Common errors & fixes
Module not found: Can't resolve 'hogan.js' in ...
hogan.js is a peer dependency that must be installed explicitly.
fix
npm install hogan.js --save
Error: Transform 'browserify-hogan' not found
browserify-hogan not installed or not in node_modules.
fix
npm install browserify-hogan --save-dev
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies
hogan.jsrequiredpeer dependency required for template compilation
Agent activity
4 hits · last 30 days
node
4
Resources
browserify-hogan — npm install browserify-hogan · libregistry