Nomenclature Processing Machine

npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

This package has been deprecated

Author message:

Plugins have been moved inside gulp-html-transform. See https://github.com/maistho/gulp-html-transform

gulp-html-transform-minify-inline-json

1.0.0 • Public • Published

gulp-html-transform-minify-inline-json

This is a plugin for gulp-html-transform

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

Loosely based on gulp-minify-inline-json

Installing

Using npm

$ npm install --save gulp-html-transform-inline-json

Using yarn

$ yarn add gulp-html-transform-inline-json

Usage

gulpfile.js

const path = require('path')
const { transform } = require('gulp-html-transform')
const { minifyInlineJson } = require('gulp-html-transform-minify-inline-json')
 
gulp.task('html', () => {
  gulp.src('src/**/*.html')
  .pipe(transform(
    minifyInlineJson({
      mimetypes: ['application/json'], // optional
    })
  ))
  .pipe(gulp.dest('dist'))
})

If you want to add the styles manually you can import index.css from the package folder and remove addStyles.

Html in:

<script type="application/json">
{
  "key": {
    "other_key": "value"
  }
}
</script> 

Html out:

<script type="application/json">{"key":{"other_key":"value"}}</script> 

API

minifyInlineJson({
  mimetypes: ['application/json', 'application/ld+json'], // optional string array of mimeTypes.
})

Keywords

none

install

npm i gulp-html-transform-minify-inline-json

Downloadsweekly downloads

1

version

1.0.0

license

MIT

last publish

collaborators

  • avatar
Report a vulnerability