Registry / devops / jstify

jstify

JSON →
library0.14.0jsnpmunverified

jstify (v0.14.0) is a Browserify transform that pre-compiles Underscore and Lo-Dash templates with optional HTML minification via HTMLMinifier. It converts .ejs, .tpl, .jst, or .html files into CommonJS modules that export compiled template functions. Key differentiators: supports configurable engine (underscore, lodash, lodash-micro, or global), optional Lo-Dash imports simulation, customizable template and minifier options, and can disable minification. Release cadence is low (last release 2020-01-17). Typical use is within a Gulp/Grunt/webpack substitute legacy build pipeline.

npm install jstify
INSTALL
IMPORT
SIG · JSTIFY
J
jstify
devopsjavascriptv0.14.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.

jstify transform (CommonJS require)
const jstify = require('jstify');
import jstify from 'jstify';
jstify is a Node.js transform, not a browser module. Use CommonJS require. It does not export a 'default' default export.
jstify/register (Node.js require hook)
require('jstify/register')(/* opts */);
require('jstify/register'); // missing calling as function
The register hook must be invoked with optional options object.
browserify transform usage
b.transform('jstify', { engine: 'lodash' })
b.transform(jstify, { engine: 'lodash' }) // passing the function directly instead of string
Pass the package name as a string, not the require'd function, when using with Browserify API.

Demonstrates using jstify as a Browserify transform with Lodash engine and custom minifier options.

const browserify = require('browserify'); const fs = require('fs'); const b = browserify('example/main.js'); b.transform('jstify', { engine: 'lodash', minifierOpts: { removeComments: false } }); b.bundle().pipe(fs.createWriteStream('bundle.js'));
Debug
Known issues
deprecatedjstify is no longer actively maintained. The last release was 0.14.0 in 2020.
fix
Consider migrating to a modern bundler like webpack or rollup with appropriate template loaders (e.g., underscore-template-loader).
affects: >=0.14.0
gotchaCommand-line options for templateOpts that require a RegExp do not work.
fix
Use the API (JavaScript) to pass RegExp options in templateOpts.
affects: >=0.1.0
gotchaSetting minifierOpts to false disables HTMLMinifier, but setting it to an object overrides defaults completely.
fix
To override individual minifier options, pass false for options you want to disable, not an empty object.
affects: >=0.1.0
deprecatedThe 'lodash' engine option generates module code that imports lodash. Consider using 'lodash-micro' for smaller bundles.
fix
Use engine: 'lodash-micro' if you only need _.escape and inline functions are not used.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'jstify'
jstify is not installed or missing from node_modules.
fix
Run 'npm install --save-dev jstify' to install it as a dev dependency.
TypeError: Cannot read property 'transform' of undefined
browserify instance not created correctly or jstify transform applied before bundler initialization.
fix
Ensure browserify is required and an instance is created before calling .transform. Example: var b = browserify(); b.transform('jstify');
Upgrade
Version history
0.14.0latest on npm
Audit
Dependencies
html-minifieroptionalUsed for HTML minification before template compilation.
through2requiredBrowserify transform stream dependency.
Agent activity
8 hits · last 30 days
node
6
Amazon
1
Resources
packagejstify
jstify — npm install jstify · libregistry