Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    fellapublic

    cjfella

    Rewrites heads of AMD modules to turn them into CommonJS

    Works only with CoffeeScript files. JS port is welcome.

    Man

    Two types of rewrite are possible.

    Simple unwrap

    define ->
      console.log "independent code"
      console.log "independent code"
      console.log "independent code"
      console.log "independent code"
      console.log "independent code"

    results into:

    console.log "independent code"
    console.log "independent code"
    console.log "independent code"
    console.log "independent code"
    console.log "independent code"

    Dependencies rewrite

    define [
      'underscore'
      'other-lib'
    ](
      _
    my_lib
    ) ->
     
      log = _.bind(console.logconsole)
      log "dependent code"

    Results into:

    = require 'underscore'
    my_lib = require 'other-lib'
     
    log = _.bind(console.logconsole)
    log "dependent code"

    Note that head of the cs file should comply to the format:

    define [
      'dep1-path'
      'dep2-path'
    ], (
      dep1name
    , dep2name
    ) ->
    

    install

    npm i fella

    Downloadsweekly downloads

    1

    version

    1.0.3

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar