Not a Propaganda Machine

    cjfella

    1.0.5 • Public • Published

    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 cjfella

    DownloadsWeekly Downloads

    1

    Version

    1.0.5

    License

    MIT

    Last publish

    Collaborators

    • ognivo