JAVASCRIPT   79

require rhino

Guest on 3rd July 2022 05:42:53 AM

  1. //
  2. // Stub out `require` in rhino
  3. //
  4. function require(arg) {
  5.     var split = arg.split('/');
  6.     var resultModule = split.length == 1 ? less.modules[split[0]] : less[split[1]];
  7.     if (!resultModule) {
  8.         throw { message: "Cannot find module '" + arg + "'"};
  9.     }
  10.     return resultModule;
  11. }

Raw Paste


Login or Register to edit or fork this paste. It's free.