Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/haensl/gulp-minify-inline-json

Minifies inline <script> tags containing JSON data, i.e. application/json and application/ld+json.
https://github.com/haensl/gulp-minify-inline-json

gulp gulp-plugin gulpplugin html inline json minify npm script

Last synced: 3 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# gulp-minify-inline-json

[![NPM](https://nodei.co/npm/gulp-minify-inline-json.png?downloads=true)](https://nodei.co/npm/gulp-minify-inline-json/)

[![npm version](https://badge.fury.io/js/gulp-minify-inline-json.svg)](http://badge.fury.io/js/gulp-minify-inline-json)
[![CircleCI](https://circleci.com/gh/haensl/gulp-minify-inline-json.svg?style=svg)](https://circleci.com/gh/haensl/gulp-minify-inline-json)

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

## Installation

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

## Usage

```javascript
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
<html>
<head><!-- ... --></head>
<body>
<!-- ... -->
<script type="application/json">{
"some": "json"
}
{
"foo": "bar"
}


{
"some": "json"
}
{"foo":"bar"}