Code Monkey home page Code Monkey logo

gulp-minify-inline-json's People

Contributors

haensl avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

maistho

gulp-minify-inline-json's Issues

Err

Hi, I get an error after run gulp minifyInlineJSON

E:\YUDY\WEB PROJECT\TIA\PROD\mm>gulp minifyInlineJSON
[15:23:53] Using gulpfile E:\YUDY\WEB PROJECT\TIA\PROD\mm\gulpfile.js
[15:23:53] Starting 'minifyInlineJSON'...
[15:23:53] Finished 'minifyInlineJSON' after 13 ms

events.js:112
      throw er; // Unhandled 'error' event
      ^
SyntaxError: Unexpected token
 in JSON at position 867
    at JSON.parse (<anonymous>)
    at Node.<anonymous> (E:\YUDY\WEB PROJECT\TIA\PROD\mm\node_modules\gulp-minify-inline-json\index.js:37:45)
    at initialize.exports.each (E:\YUDY\WEB PROJECT\TIA\PROD\mm\node_modules\gulp-minify-inline-json\node_modules\cheerio\lib\api\traversing.js:300:24)
    at DestroyableTransform.through.obj [as _transform] (E:\YUDY\WEB PROJECT\TIA\PROD\mm\node_modules\gulp-minify-inline-json\index.js:31:8)
    at DestroyableTransform.Transform._read (E:\YUDY\WEB PROJECT\TIA\PROD\mm\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (E:\YUDY\WEB PROJECT\TIA\PROD\mm\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:172:83)
    at doWrite (E:\YUDY\WEB PROJECT\TIA\PROD\mm\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:418:64)
    at writeOrBuffer (E:\YUDY\WEB PROJECT\TIA\PROD\mm\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:407:5)
    at DestroyableTransform.Writable.write (E:\YUDY\WEB PROJECT\TIA\PROD\mm\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:334:11)
    at write (E:\YUDY\WEB PROJECT\TIA\PROD\mm\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:623:24)

This is my gulpfile.js

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

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

Try with option below then run gulp minifyJSON the result is the same

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



gulp.task('minifyJSON', () =>
    gulp.src('public/**/*.html')
      .pipe(minifyJSON({
        mimeTypes: [
          'application/ld+json'
        ]
      }))
      .pipe(gulp.dest('public/./')));

this is sample from my inline json

<script type="application/ld+json">
{ "@context": "http://schema.org", 
 "@type": "BlogPosting",
 "headline": "Lorem ipsum",
 "image": "http://localhost:1313//image/content/2018/02/lorem.jpg",
 "wordcount": "1025",
 "url": "http://localhost:1313/lorem/",
 "datePublished": "2018-2-24",
 "dateCreated": "2018-2-24",
 "dateModified": "2018-2-26",  
 "description": "Lorem ipsum dolor amet vice PBR&B selfies farm-to-table wayfarers craft beer hashtag. Offal skateboard neutra copper mug ",
 "articleBody": " Lorem ipsum dolor amet vice PBR&B selfies farm-to-table wayfarers craft beer hashtag. Offal skateboard neutra copper mug asymmetrical brooklyn. Yuccie mustache occupy disrupt meggings hot chicken. Photo booth 8-bit skateboard hoodie. ๐Ÿ˜‰
Tilde vegan health goth, knausgaard austin 90's ethical williamsburg beard shabby chic vexillologist. Man braid green juice taxidermy, organic paleo pinterest hella. Ugh meggings tacos kogi palo santo banh mi. &#43; Tilde vegan health goth, knausgaard austin 90's ethical williamsburg beard shabby chic vexillologist. Man braid green juice taxidermy, organic paleo pinterest hella. Ugh meggings tacos kogi palo santo banh mi.",
   "author": {
    "@type": "Person",
    "name": "John Doe"
  },
 "mainEntityOfPage": "True",
 "publisher": {
  "@type": "Organization",
  "name": "example.com",
  "logo": {
  "@type": "imageObject",
  "url": "http://localhost:1313/image/asset/banner.jpg"
}
}
 }
</script>

any clue?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.