Browse Source

grunt-amberc.js: add support for JS globals

Manfred Kroehnert 11 years ago
parent
commit
85cddce253
1 changed files with 6 additions and 2 deletions
  1. 6 2
      grunt/tasks/grunt-amberc.js

+ 6 - 2
grunt/tasks/grunt-amberc.js

@@ -15,14 +15,15 @@ module.exports = function(grunt) {
        helloWorld: {
          src: ['projects/HelloWorld/st/HelloWorld.st'], // REQUIRED
          output_dir: 'projects/HelloWorld/js',  // optional
+         libraries: 'Canvas',                   // optional
+         jsGlobals: ['global1', 'global2'],     // optional
          main_class: 'HelloWorld',              // optional
          output_name: 'helloWorld',            // optional
-         libraries: 'Canvas',                  // optional
          init: 'myInit',                       // optional
          main_file: 'myMain.js',               // optional
          deploy: true,                         // optional
          output_suffix: 'mySuffix',            // optional
-         library_suffix: '-0.9'               // optional
+         library_suffix: '-0.9'                // optional
        },
      },
 
@@ -112,6 +113,9 @@ module.exports = function(grunt) {
     if (undefined !== data.output_dir) {
       configuration.output_dir = data.output_dir;
     }
+    if (undefined !== data.jsGlobals) {
+      configuration.jsGlobals.push.apply(configuration.jsGlobals, data.jsGlobals);
+    }
     configuration.verbose = data.verbose;
     return configuration;
   }