eduardolundgren / gulp-umd

Gulp plugin for build JavaScript files as Universal Module Definition, aka UMD
MIT License
126 stars 14 forks source link

LiveScript support #3

Open unclechu opened 9 years ago

unclechu commented 9 years ago

Any solutions for LiveScript support? Or CoffeeScript or TypeScript?

eduardolundgren commented 9 years ago

Any resource example for how that should look like?

unclechu commented 9 years ago

Now wrapper looks like this:

(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.EXPORT_VAR_NAME = factory();
}
}(this, function() {
return SOME_VAR_NAME;
}));

But we can't wrap LiveScript or CoffeeScript or TypeScript code (if we doesn't build native js). But if gulp-umd could, that must looks like something like this (LiveScript):

let
  init = (root, factory) !->
    if typeof define is \function and define.amd
      define [] , factory
    else if typeof exports is \object
      module.exports = factory!
    else
      root.EXPORT_VAR_NAME = factory!
  init this , ->
    SOME_VAR_NAME
unclechu commented 9 years ago

It looks like I can just create some another template, and use this templates in "template" option for gulp task?

eduardolundgren commented 9 years ago

SGTM. Yes, could you send this template implementation?