Skip to content

Commit 4bcd816

Browse files
committed
Update README
1 parent 31eeeee commit 4bcd816

File tree

5 files changed

+103
-92
lines changed

5 files changed

+103
-92
lines changed

.gitattributes

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
/.github/ export-ignore
2-
/.gitattributes export-ignore
3-
/.gitignore export-ignore
4-
/tests export-ignore
1+
# git
2+
.github/ export-ignore
3+
.git export-ignore
4+
.gitattributes export-ignore
5+
.gitignore export-ignore
6+
# development
7+
tests/ export-ignore
8+
*.cmd export-ignore
9+
# other
10+
logo.* export-ignore
11+
preview.* export-ignore

README.md

Lines changed: 59 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
1-
## Overview
1+
# CoffeeScript <img src="logo.svg" title="CoffeeScript" width="32" height="32">
22

3-
**This package is for Sublime Text 3+**.
4-
An old version for Sublime Text 2 is accessible via the [`st2` branch](https://github.com/SublimeText/BetterCoffeeScript/tree/st2).
5-
6-
## Description
3+
[CoffeeScript](https://coffeescript.org/) syntax definitions build system and snippets for [Sublime Text](https://www.sublimetext.com).
74

8-
CoffeeScript plug-in was originally created by @Xavura. As I, @aponxi, began writing a lot of code in CoffeeScript, I felt the need for side-by-side view for compiled CoffeeScript. Since Xavura's repository have been inactive I decided to branch out my own version. The biggest change in my branch is the Watch Mode which updates the compiled JavaScript view whenever you modify the CoffeeScript thus enabling you to view your progress side-by-side.
5+
![preview](preview.png)
96

10-
## Contributing
11-
12-
- Please use the [issues page](https://github.com/SublimeText/BetterCoffeeScript/issues) to make requests or report bugs.
13-
- Please make _pull requests_ to the `master` branch only. ST2 is not supported anymore.
7+
**This package is for Sublime Text 3+**.
8+
An old version for Sublime Text 2 is accessible via the [`st2` branch](https://github.com/SublimeText/BetterCoffeeScript/tree/st2).
149

1510
# Installation
1611

17-
## via Package Control
18-
19-
> This is the recommended installation method.
12+
### Package Control
2013

21-
If you have [Package Control](https://packagecontrol.io/), you know what to do. If not, well: it's a package manager for Sublime Text 3. Installation guide can be [found here](https://packagecontrol.io/installation). After installing the package manager:
14+
The easiest way to install is using [Package Control](https://packagecontrol.io). It's listed as `CoffeeScript`.
2215

23-
* Open the Command Pallete (`ctrl+shift+P` or `cmd+shift+P`).
24-
* Type "Install Package" and hit return.
25-
* Type "CoffeeScript" and hit return.
16+
1. Open `Command Palette` using <kbd>ctrl+shift+P</kbd> or menu item `Tools → Command Palette...`
17+
2. Choose `Package Control: Install Package`
18+
3. Find `CoffeeScript` and hit <kbd>Enter</kbd>
2619

27-
## via Source Control
20+
## Source Control
2821

29-
> If you plan to contribute, then you should install via this method. Otherwise it is recommended that you install the package via Package Control, see above.
22+
> [!TIP]
23+
>
24+
> Only recommended, if contributions to this package are planned.
3025
3126
Sublime stores packages in the following locations:
3227

33-
Nix: ~/.config/sublime-text-3/packages
34-
Mac: ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
35-
Win: %APPDATA%\Sublime Text 3\Packages
36-
37-
When using Sublime Text 4 or higher,
38-
the directory without the "3" (and the preceding separator character)
39-
will be preferred.
28+
```sh
29+
Nix: ~/.config/sublime-text/packages
30+
Mac: ~/Library/Application\ Support/Sublime\ Text/Packages
31+
Win: %APPDATA%\Sublime Text\Packages
32+
```
4033

4134
### As a repository within the packages directory
4235

4336
Open a Terminal/Console and run the following commands, replacing `PACKAGE_PATH` with the path corresponding to your OS above.
4437

45-
cd PACKAGE_PATH
46-
git clone https://github.com/SublimeText/BetterCoffeeScript.git "CoffeeScript"
38+
```sh
39+
cd PACKAGE_PATH
40+
git clone https://github.com/SublimeText/BetterCoffeeScript.git "CoffeeScript"
41+
```
4742

4843
### As a repository outside of the packages directory
4944

5045
If you use Github for Mac/Windows which store repositories in a specific location, or if you just don't want a repository in your packages directory, then instead you can use a link.
5146

52-
If you don't yet have the repository, then grab it via your GUI program or via the command line:
53-
54-
cd WHEREVER_YOU_WANT
55-
git clone https://github.com/SublimeText/BetterCoffeeScript.git
56-
57-
Once that is done, we will create the link:
58-
59-
#### Windows:
60-
61-
cd PACKAGE_PATH
62-
mklink /D "CoffeeScript" ABSOLUTE_PATH_TO_REPOSITORY
63-
64-
#### Nix/Mac:
65-
66-
cd PACKAGE_PATH
67-
ln -s ABSOLUTE_PATH_TO_REPOSITORY "CoffeeScript"
68-
47+
1. Clone the repository via GUI program or command line:
48+
49+
```sh
50+
cd WHEREVER_YOU_WANT
51+
git clone https://github.com/SublimeText/BetterCoffeeScript.git
52+
```
53+
54+
2. Once that is done, create the link:
55+
56+
**Windows:**
57+
58+
```sh
59+
cd PACKAGE_PATH
60+
mklink /D "CoffeeScript" ABSOLUTE_PATH_TO_REPOSITORY
61+
```
62+
63+
**Nix/Mac:**
64+
65+
```sh
66+
cd PACKAGE_PATH
67+
ln -s ABSOLUTE_PATH_TO_REPOSITORY "CoffeeScript"
68+
```
6969

7070
# Commands/Shortcuts
7171

@@ -86,8 +86,6 @@ Context menu has `Compile Output` that compiles the current CoffeeScript and out
8686

8787
**Note:** Some of the commands use the Status Bar for output, so you'll probably want to enable it (View » Show Status Bar).
8888

89-
90-
9189
# Snippets
9290

9391
- Use `TAB` to run a snippet after typing the trigger.
@@ -144,7 +142,7 @@ That's what this is for! You would create a `Cakefile` and inside it you would w
144142

145143
Go to `Preferences > Package Settings > CoffeeScript > Settings - User` to change settings.
146144

147-
```Javascript
145+
```jsonc
148146
{
149147
/*
150148
The directories you would like to include in $PATH environment variable.
@@ -159,34 +157,34 @@ Go to `Preferences > Package Settings > CoffeeScript > Settings - User` to chang
159157
The directory containing your coffee binary. Usually
160158
/usr/local/bin.
161159
*/
162-
"binDir": "/usr/local/bin"
160+
"binDir": "/usr/local/bin",
163161

164162
/*
165163
Compile without the top-level function wrapper (coffee -b).
166164
*/
167165

168-
, "noWrapper": true
166+
"noWrapper": true,
169167

170168
/*
171169
Enable or disable refresh the compiled Output on Save.
172170
Only available for watch mode.
173171
*/
174-
, "watchOnSave": true
172+
"watchOnSave": true,
175173
/*
176174
Enable refreshing compiled JS when CoffeeScript is modified.
177175
178176
Put false to disable
179177
Put a number of seconds to delay the refresh
180178
*/
181-
, "watchOnModified": 0.5
179+
"watchOnModified": 0.5,
182180
/*
183181
Enable Compiling on save. It will compile into the same folder.
184182
*/
185-
, "compileOnSave": true
183+
"compileOnSave": true,
186184
/*
187185
## Enable outputting the results of the compiled coffeescript in a panel
188186
*/
189-
, "showOutputOnSave": false
187+
"showOutputOnSave": false,
190188
/*
191189
## Enable compiling to a specific directory.
192190
#### Description
@@ -201,7 +199,7 @@ Go to `Preferences > Package Settings > CoffeeScript > Settings - User` to chang
201199
compileDir": "/home/logan/Desktop/out"
202200
203201
*/
204-
, "compileDir": false
202+
"compileDir": false,
205203
/*
206204
## Enable compiling to a specific relative directories.
207205
@@ -223,38 +221,27 @@ Go to `Preferences > Package Settings > CoffeeScript > Settings - User` to chang
223221
"/home/user/projects/main.coffee" will compile to "/home/user/projects/js/main.js"
224222
225223
*/
226-
, "compilePaths": false
227-
228-
229-
224+
"compilePaths": false,
230225
}
231-
232-
233226
```
234227

235228
## Project settings
236229

237230
Go to `Project > Edit Project` to change project settings.
238231

239-
```Javascript
232+
```json
240233
{
241-
"folders":
242-
[
243-
...
234+
"folders": [
235+
"."
244236
],
245-
"settings":
246-
{
247-
"CoffeeScript":
248-
{
237+
"settings": {
238+
"CoffeeScript": {
249239
"noWrapper": true,
250240
"compileOnSave": true,
251241
"compileDir": "out"
252242
}
253243
}
254244
}
255-
256-
257-
258245
```
259246

260247
# FAQ
@@ -294,19 +281,3 @@ This path will go into the `binDir` setting.
294281
- I'm getting the error message `'coffee' is not recognized as an internal or external command,` when saving.
295282

296283
The coffee-script binary probably is not installed. Either install coffee-script or set `checkSyntaxOnSave` and `compileOnSave` to `false` in `Preferences > Package Settings > CoffeeScript > Settings - User`.
297-
298-
299-
300-
# Latest Changelog
301-
### v0.7.0 01/June/2013
302-
303-
- merged st3 with master branch
304-
- now the sublime text 2 support is in st2 branch
305-
- fixed the @ highlight in language definitions
306-
- fixed an error you would get when it was looking for project settings when it wasn't a project we were editing
307-
308-
# Special Thanks
309-
310-
311-
Thanks to [everyone who has contributed to this project](https://github.com/SublimeText/BetterCoffeeScript/graphs/contributors).
312-
You guys rock!

logo.svg

Lines changed: 3 additions & 0 deletions
Loading

preview.coffee

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Assignment:
2+
number = 42
3+
opposite = true
4+
5+
# Conditions:
6+
number = -42 if opposite
7+
8+
# Functions:
9+
square = (x) -> x * x
10+
11+
# Arrays:
12+
list = [1, 2, 3, 4, 5]
13+
14+
# Objects:
15+
math =
16+
root: Math.sqrt
17+
square: square
18+
cube: (x) -> x * square x
19+
20+
# Splats:
21+
race = (winner, runners...) ->
22+
print winner, runners
23+
24+
# Array comprehensions:
25+
cubes = (math.cube num for num in list)
26+
27+
# Existence:
28+
alert "I knew it!" if elvis?
29+
30+

preview.png

69.1 KB
Loading

0 commit comments

Comments
 (0)