Comments (8)
Do you want to run from the command line JSON.minify?
Well, I have already made a thing called mjson https://github.com/fkei/node-mjson
Please try it here.
from json.minify.
Wow great !
Well excepted a few details
(but as always, details are what matters most)
$ cat ./test/comment.json | mjson.js
People with unix background will warn you that this is a Useless Use of Cat : http://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat)
No problem, this does the same job
$ mjson.js < ./test/comment.json
But of course we can do better
$ mjson.js ./test/comment.json
I didn't try if it's possible, but mjson.js --help seems to imply that no.
I hope this is not a restriciton of node.js, that would be weird :(
But wait, standard ouput is fine for using with demo, but it is not what you use once you understand it. More like
$ mjson.js manifest-with-comments.json > manifest.json
or better
$ mjson.js manifest-with-comments.json -o manifest.json
But then there is the suggestion I made, inspired by Ruby on Rails's Convention over configuration principle
http://en.wikipedia.org/wiki/Convention_over_configuration
$ mjson.js manifest-with-comments.json # does the same thing as before since the pattern is recognized
This would be great because:
- All projects will use the same convention
- People that will enter the project will be less confused on why there are two json files
- With this you can do something like
$ find . -name "*-with-comments.json" | xargs mjson.js
- Then you can let git triggers it everytime you commit
Then this has to be documented of course, so a documentatinon pull request has to be opened on
getify#13
I am sure this would be really useful, I hope this is not too much to ask :-)
from json.minify.
@internaciulo
Since mjson is a separate project by @fkei I think the request to change the behavior of that utility belongs there in that repo rather than in this thread for JSON.minify. Again, if someone decides at some point to put in a Pull-Request to my main repo that adds in a CLI utility, I'll be happy to consider it. But until then, it's not really a JSON.minify issue.
Also, note: it's typical that when you make such requests (to change someone's existing code), you actually put in a Pull-Request with the changes implemented, instead of just expecting the author to change something to your desires. If a utility exists, but it's not exactly what you want, and you can't make the changes to his code, I'd suggest you instead just write a little bash-script wrapper to conform it to your desired usage.
from json.minify.
This is very off topic, but since you bring it there:
Also, note: it's typical that when you make such requests (to change someone's existing code), you actually put in a Pull-Request with the changes implemented, instead of just expecting the author to change something to your desires. I
I do know that it's typical, but it's really sad, since bug trackers and pull request are aimed primarily at tracking and correcting, well, bugs
But ideas, design, feedback are as bit important as code and bugs and it's just awkard to discuss them with pull requests and bug trackers
That's why many free software projects that could be great never succeed.
They just don't use the apropriate tools like http://uservoice.com/
I promise that I would never use bug trackers to discuss things that are not bugs if I had a choice.
But that's just not the cas right now.
from json.minify.
I'll implement this future when I find time.
from json.minify.
Great
from json.minify.
Hi
Added a specification that had requested. Please look by using all means.
Document: https://github.com/fkei/node-mjson#command-line-options
Commit : fkei/node-mjson@8bb2acb
$ npm install [email protected]
Finally, I agree completely with @getify opinion.
from json.minify.
Hello fkey,
well first thanks a lot
I have so much projects right now, that I can't do much right now.
But I promise I will look at what you did, see what I can do to improve it or just tell the world if it is already perfect :-D
from json.minify.
Related Issues (11)
- utf8 issues? HOT 1
- jsonminify( [ ] ) --> "" HOT 2
- not remove last whitespaces
- not remove comments last line
- An empty object transforms to an empty string
- Please update JSON.minify(..) for important fix HOT 2
- FreeBSD support HOT 1
- Option to only strip comments, no minify HOT 2
- Leaves few whitespaces at the end HOT 5
- faster minify functions?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json.minify.