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

gulp-minify-inline-json

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-minify-inline-json

Gulp plugin to minify inline JSON.

  • 1.4.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
increased by175%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-minify-inline-json

NPM

npm version CircleCI

Minifies inline <script> tags containing JSON data, i.e. application/json and application/ld+json.

Installation

npm i --save-dev gulp-minify-inline-json

Usage

const minifyInlineJSON = require('gulp-minify-inline-json');

gulp.task('minifyInlineJSON', () =>
  gulp.src('*.html')
    .pipe(minifyInlineJSON())
    .pipe(gulp.dest('dist/')));

Options

mimeTypes Array<string>

Provide custom mime types to specify which <script> tags to minify.

default: [ 'application/json', 'application/ld+json' ]
Example: Minify only tags with type="application/ld+json"
HTML Layout
<html>
  <head><!-- ... --></head>
  <body>
    <!-- ... -->
    <script type="application/json">{
      "some": "json"
    }</script>
    <script type="application/ld+json">{
      "foo": "bar"
    }</script>
  </body>
</html>
Gulp task
  const minifyJSON = require('gulp-minify-inline-json');

  gulp.task('minifyJSON', () =>
    gulp.src('*.html')
      .pipe(minifyJSON({
        mimeTypes: [
          'application/ld+json'
        ]
      }))
      .pipe(gulp.dest('dist/')));
Output
<html>
  <head><!-- ... --></head>
  <body>
    <!-- ... -->
    <script type="application/json">{
      "some": "json"
    }</script>
    <script type="application/ld+json">{"foo":"bar"}</script>
  </body>
</html>

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