Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minify-inline-json

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minify-inline-json

Minify inlined/embedded JSON data within script tags

  • 1.1.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

minify-inline-json

Node.js module to minify inlined/embedded JSON data within script tags.

NPM

CircleCI

Installation

NPM

npm i --save minify-inline-json

Yarn

yarn add minify-inline-json

Usage

Synopsis

/**
 * Minify inline JSON data in the given string.
 * When minifyInlineJson() encounters a script tag with JSON mime type,
 * e.g.
 *  <script type="application/json">{
 *    // ...
 *  }</script>
 * it will minify the JSON found within the script tag.
 *
 * @param {string} html the string to process.
 * @param {object} options configuration options.
 * @returns {string} the processed string.
 */
minifyInlineJson(html, options);

Example

const minifyInlineJson = require('minify-inline-json');
const fs = require('fs');

const html = fs.readFileSync('index.html', 'utf8');
minifyInlineJson(html);

Options

mimeTypes Array<string> | string

Default: ['application/json', 'application/ld+json']

Specify the mime type(s) of scripts to minify JSON data in.

Changelog

License

Keywords

FAQs

Package last updated on 25 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc