require-sugar

0.1.4 • Public • Published

require-sugar build status

require-sugar is a simple preprocessor for JavaScript and CoffeeScript which provides a custom syntax for defining dependencies for RequireJS.

Example transformation

Original source:

### define
jquery : $
underscore : _
###

code()

Output source:

define(["jquery", "underscore"], function ($, _) {
  code();
});

Installation

$ npm install require-sugar

Example integration with gulp

For JavaScript:

gulp.src(options.src.scripts)
  .pipe(requireSugar())                      // <--
  .pipe(gulp.dest(options.dest.scripts));

CoffeeScript files should be processed as coffee-files and not as js-files. This leverages CoffeeScript's feature that the last statement is always returned.

gulp.src(options.src.scripts)
  .pipe(requireSugar())                      // <--
  .pipe($.coffee())
  .pipe(gulp.dest(options.dest.scripts));

License

MIT © scalable minds 2014

Readme

Keywords

Package Sidebar

Install

npm i require-sugar

Weekly Downloads

0

Version

0.1.4

License

MIT

Last publish

Collaborators

  • philippotto