Add some Spice to Espresso

Whether you are a user or Sugar developer, Spice makes it easy to customize your favorite text editor using clean, object-oriented Javascript without needing to know anything about Objective-C or the Espresso API. Enjoy live updating actions (no need to relaunch Espresso to see your changes!), the MooTools server suite of tools and classes, and if you need it full access to the Espresso API and Cocoa via JSCocoa. Spice actions can live inside third-party sugars or even be custom to your computer along using TEA for Espresso’s custom user actions. You choose your flavor.

Spice is currently in early beta, which means now is the perfect time to try it out and let me know what works for you and what doesn’t.

Installation

To install, download and unzip the latest version. If you have never installed Spice, double click the file in the zip and relaunch Espresso to install.

If you have previously installed Spice, visit ~/Library/Application Support/Espresso/Sugars/ and delete the existing Spice.sugar file before double clicking the new one to install.

Getting Started

Spice on its own adds nothing visible to Espresso as it doesn’t include any action definitions. To see what it can do, install the included ExampleSpice.sugar and relaunch Espresso.

Once the ExampleSpice.sugar is installed, you can experiment with Spice simply by editing the ExampleSpice.sugar’s action:

  1. Right click ExampleSpice.sugar in the Finder
  2. Choose “Show Package Contents”
  3. Navigate to Support/Scripts
  4. Open up hello_world.js in your favorite editor

After making changes to hello_world.js, just save it and run the “Hello Spicy World” action again in Espresso. No need to restart the program!

If you make changes to ExampleSpice.sugar/TextActions/Actions.xml a program restart will be necessary for Espresso to notice them; Espresso currently offers no way around this.

Both files within ExampleSpice.sugar are heavily documented; for now examining them is the best way to get up to speed on what’s necessary to create your own custom actions.

Besides the example sugar, here are some real-world examples of custom actions powered by Spice:

For more information about Spice’s Javascript API, please see the documentation.

Clicky Web Analytics