Registry / serialization / stringify

stringify

JSON →
library5.2.0jsnpmunverified

Browserify transform to require() text files (HTML, templates, etc.) as strings in client-side JavaScript. Version 5.2.0 is the latest release; the package is no longer actively maintained by the author but accepts PRs. It supports Node >=4.0.0 (tested up to 8.1.3). Key differentiators: simple setup, optional minification via html-minifier, Node.js require hook. Alternatives like brfs or rawify are more actively maintained.

serializationhttp-networkingdevops
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.

Package is CommonJS only; no ESM or default export.

const stringify = require('stringify');

Called after requiring stringify as shown.

stringify.registerWithRequire({...});

The transform must be passed as a function, not a string, and MUST be called before .add()

browserify().transform(stringify, { appliesTo: { includeExtensions: ['.html'] } })

Shows how to use stringify with Browserify to bundle HTML files as strings.

const browserify = require('browserify'); const stringify = require('stringify'); const fs = require('fs'); const b = browserify(); b.transform(stringify, { appliesTo: { includeExtensions: ['.html'] } }); b.add('./entry.js'); b.bundle().pipe(fs.createWriteStream('bundle.js')); // entry.js: // const template = require('./template.html'); // console.log(template);
Debug
Known footguns
deprecatedPackage no longer actively maintained; open issues may not be addressed.
gotchaThe transform MUST be applied via .transform() before .add() — order matters.
gotchaNode.js usage via stringify.registerWithRequire() might conflict with Browserify usage if both are used in same process.
gotchaRequiring configuration from package.json may lead to unexpected behavior if key is a file path relative to cwd.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources