cauterize-tools / caut-javascript-ref

Reference implementation for a JavaScript Cauterize transcoder.
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

RequireJS support? #1

Open bvanderveen opened 9 years ago

bvanderveen commented 9 years ago

I've been working to use cauterize output in-browser. Unfortunately the require provided by node (and used in the JS templates in this project) isn't available in browsers. Moreover, because browsers load scripts asynchronously, we can't synchronously assign a module to a variable ( var foo = require('foo.js') ).

RequireJS is of a few tools that address this issue:

define(['dep1', 'dep2'], function(dep1, dep2) { 
  var exports = {};
  …
  return exports;
});

The alternative would be to use something like Browserfy to amalgamate scripts output by cauterize into a single file.

Would you accept a patch which added RequireJS support?

bvanderveen commented 9 years ago

This is my WIP:

https://github.com/bvanderveen/caut-javascript-ref/tree/requirejs-support

Would need to add the option to CautJSOpts, pass it down to the template renderer, and finally add branches in the templates.

sw17ch commented 9 years ago

Hello! Thanks for your interest in Cauterize. Unfortunately, my expertise in JavaScript isn't what it would be. Because of this, I am exceptionally open to pull requests involving quality of life issues in the JavaScript implementation.