-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leaves few whitespaces at the end #8
Comments
I tried to minify this json. Use below code. // foo.js
var fs = require("fs");
var jsonminify = require("jsonminify");
var raw = fs.readFileSync('/tmp/11240696/gistfile1.txt', 'utf-8');
var out = jsonminify(raw);
console.log("---------");
console.log(out)
console.log("---------"); But output has no whitespece. $ node foo.js
---------
{"glossary":{"title":"example glossary","GlossDiv":{"title":"S","GlossList":{"GlossEntry":{"ID":"SGML","SortAs":"SGML","GlossTerm":"Standard Generalized Markup Language","Acronym":"SGML","Abbrev":"ISO 8879:1986","GlossDef":{"para":"A meta-markup language, used to create markup languages such as DocBook.","GlossSeeAlso":["GML","XML"]},"GlossSee":"markup"}}}}}
--------- I have no idea why your output has whitespace. |
Perhaps they are tabs, hard-space, or other whitespace that the RegEx doesn't check? |
ok, I've uploaded relevant source code here - https://dl.dropboxusercontent.com/u/9555782/json-minify.zip Code is bit involved than just json minification and it is quite possible that the bug is not in json minify itself but some other piece of code. Code is pretty straightforward to understand and see what's going on. I'm still unable to figure out from where does mysterious trailing whitespaces appear. Help is much appreciated. |
I can get reproduce the bug, but the cause is unknown. It works correctly with text format (ex: #8 (comment)), so I think server is the cause of this bug. I'll close this issue, but if you can reproduce the bug with text format(not binary format), give me the code and reopen this issue plase. |
Yeah, not a problem. Probably this ain't issue with json-minify anyway. But, What do you by reproducing it in text format and giving you the code? I think I already did that. |
For an example, I've tried to minify JSON document here - https://gist.github.com/syst3mw0rm/11240696 and the output I got is - https://gist.github.com/syst3mw0rm/11240705 which contains few whitespaces at the end which we should get rid off in minified version.
The text was updated successfully, but these errors were encountered: