Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including transform with all npm packages installed. Try it out:

var transform = require("transform")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

transform v1.1.2

The ultimate transformation/build/compilation middleware/command line/etc. system for node.js

transform

The ultimate transformation/build/compilation middleware/command line/etc. system for node.js

Dependency Status NPM version

For a list of supported languages, check out transformers. Here are a few highlights:

  • coffee-script
  • less
  • stylus
  • sass
  • js (pass through except for minify option)
  • css (pass through except for minify option)

You also get the following functionality for free:

  • minification automatically enabled for production (for JavaScript, CSS and JSON outputs)
  • gzip automatically enabled for production
  • etags for caching automatically enabled for produciton

If you think I've missed something, be sure to open an issue or submit a pull request.

Installation

First install the transform library:

$ npm install transform

Then make sure you also install whichever transform(s) you depend on, e.g.

$ npm install jade coffee-script

Usage

To get a transform, just pass the name of the transform, e.g.:

var coffee = require('transform')('coffee-script');
var jade = require('transform')('jade');

To serve a file with default options, just give it a file name:

app.get('/client.js', coffee('./client.coffee'));
app.get('/', jade('./index.jade'));

File paths are always resolved relative to the calling file using node's "require" algorithm.

By default, files are minified (if they result in JavaScript, JSON or CSS), cached and gzipped in production, but not in development.

You can change these settings on a case by case basis, e.g.

app.get('/client.js', coffee('./client.coffee', {minify: false}));
app.get('/client.min.js', coffee('./client.coffee', {minify: true}));

You can change options for all environments, or just specific ones:

jade.settings('self', true);
jade.settings.development('pretty', true);
jade.settings.production('debug', false);

License

MIT

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free