ActiveState Community

[Macro] Minify JavaScript & CSS, compile Sass to CSS on the fly

Posted by stan on 2009-06-02 14:01

What it does:

Minify (compress) your JavaScript & CSS, compile Sass to CSS upon saving. No extra keystrokes.

From this:

// A simple function.
function hello(longName) {
  alert('Hello, ' + longName);
}
hello('New User');
// A simple function.
function hello(longName) {
  alert('Hello, ' + longName);
}
hello('New User');

To this:

function hello(a){alert("Hello, "+a)}hello("New User");
function hello(a){alert("Hello, "+a)}hello("New User");

With no additional mouse clicks or keystrokes.

Prerequisites

How to Install?

Make you you've got the latest Komodo Edit/IDE installed first. Then simply download, drag & drop the .kpz file inside your Toolbox.
Right click on the 'Compile' macro under 'Compile-0.3' and select 'Properties'. There are a few constants you'd need to set up to adopt the script for your local setup. Follow the included instructions.

How to Use?

Save a file with any of the following extensions:

  • .uncompressed.js
  • .unprocessed.js
  • .jssrc
  • .uncompressed.css
  • .unprocessed.css
  • .sass

A new file will be placed in the same directory which is the compressed/compiled version.

[Source code]

Download

stan | Fri, 2009-11-06 04:17

Updated to include support for Google's new Closure Compiler:
http://code.google.com/closure/compiler/docs/gettingstarted_app.html