Skip to content

Commit 0762cbd

Browse files
twlatlinfininight
authored andcommitted
Add Minify Document command
After months of using other tools to minify my JSON, I figured the JSON TM bundle should be able to do this. Sharing with all now.
1 parent 06b38d5 commit 0762cbd

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

Commands/Minify Document.tmCommand

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>beforeRunningCommand</key>
6+
<string>nop</string>
7+
<key>command</key>
8+
<string>#!/usr/bin/env ruby20
9+
require 'json'
10+
stdin = STDIN.read
11+
begin
12+
stdin = JSON.parse(stdin).to_json
13+
print stdin
14+
end
15+
</string>
16+
<key>input</key>
17+
<string>selection</string>
18+
<key>inputFormat</key>
19+
<string>text</string>
20+
<key>keyEquivalent</key>
21+
<string>^M</string>
22+
<key>name</key>
23+
<string>Minify Document / Selection</string>
24+
<key>outputCaret</key>
25+
<string>heuristic</string>
26+
<key>outputFormat</key>
27+
<string>text</string>
28+
<key>outputLocation</key>
29+
<string>replaceInput</string>
30+
<key>scope</key>
31+
<string>source.json</string>
32+
<key>uuid</key>
33+
<string>66890766-DB96-4772-B2D3-82ACB5DD6823</string>
34+
<key>version</key>
35+
<integer>2</integer>
36+
</dict>
37+
</plist>

info.plist

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<key>items</key>
1414
<array>
1515
<string>4B74F2DE-E051-4E8D-9124-EBD90A2CDD2B</string>
16+
<string>66890766-DB96-4772-B2D3-82ACB5DD6823</string>
17+
<string>------------------------------------</string>
1618
<string>CB0DD80E-CD51-49C3-A89C-57E8C3168067</string>
1719
</array>
1820
</dict>

0 commit comments

Comments
 (0)