-
Notifications
You must be signed in to change notification settings - Fork 14
/
Compile JSX.tmCommand
48 lines (43 loc) · 1.11 KB
/
Compile JSX.tmCommand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveActiveFile</string>
<key>command</key>
<string>#!/usr/bin/env bash
IFS=""
jsxhint $TM_FILEPATH
if [ ! $? -eq 0 ]; then
exit
fi
JSX_TEMP=$(mktemp ${TM_DIRECTORY}/.jsx-compile.XXXXXX)
JSX_OUTPUT=$(jsx $TM_FILEPATH 2>&1 > $JSX_TEMP)
if [ $? -eq 0 ]; then
mv $JSX_TEMP ${TM_FILEPATH:0: -1}
else
rm $JSX_TEMP
fi
echo $JSX_OUTPUT | perl -pe 's/\e\[?.*?[\@-~]//g'</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>@s</string>
<key>name</key>
<string>Compile JSX</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>text</string>
<key>outputLocation</key>
<string>toolTip</string>
<key>scope</key>
<string>meta.source.js.react</string>
<key>uuid</key>
<string>CA63DB1B-D689-42FB-986C-92D85DE2C600</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>