https://github.com/haensl/gulp-embed-json
Gulp plugin to inline/embed JSON data into HTML files.
https://github.com/haensl/gulp-embed-json
automation ci embed gulp gulp-plugin gulp-tasks gulpplugin html inline inline-json json npm npm-module npm-package
Last synced: about 1 month ago
JSON representation
Gulp plugin to inline/embed JSON data into HTML files.
- Host: GitHub
- URL: https://github.com/haensl/gulp-embed-json
- Owner: haensl
- License: mit
- Created: 2017-11-22T19:37:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T19:01:46.000Z (over 3 years ago)
- Last Synced: 2025-10-25T23:56:50.094Z (8 months ago)
- Topics: automation, ci, embed, gulp, gulp-plugin, gulp-tasks, gulpplugin, html, inline, inline-json, json, npm, npm-module, npm-package
- Language: JavaScript
- Homepage:
- Size: 267 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# gulp-embed-json
Gulp plugin to inline/embed JSON data into HTML files.
[](https://nodei.co/npm/gulp-embed-json/)
[](http://badge.fury.io/js/gulp-embed-json)
[](https://circleci.com/gh/haensl/gulp-embed-json)
## Installation
```shell
npm i --save-dev gulp-embed-json
```
## Quick Start
```javascript
const embedJSON = require('gulp-embed-json');
gulp.task('embedJSON', () =>
gulp.src('*.html')
.pipe(embedJSON())
.pipe(gulp.dest('dist/')));
```
This gulp task will inline/embed any scripts with JSON source attribute and respective mime type.
## Options
### mimeTypes `string | Array`
Provide custom mime types to specify which `` tags should be embedded.
#### default: `application/json, application/ld+json`
##### Example: Embed only tags with `type="application/ld+json"`
HTML layout
```html
<html>
<head><!-- ... --></head>
<body>
<!-- ... -->
<script type="application/json" src="data.json">
{"@context":"http://schema.org","@type":"SoftwareApplication","name":"gulp-embed-json"}
{"foo":"bar"}
{
"foo": "bar"
}