2
0
Kaynağa Gözat

amd config builder grunt task. Fixes #1080.

Herbert Vojčík 9 yıl önce
ebeveyn
işleme
43d8a885f0
1 değiştirilmiş dosya ile 34 ekleme ve 0 silme
  1. 34 0
      external/amber-dev/tasks/grunt-amdconfig.js

+ 34 - 0
external/amber-dev/tasks/grunt-amdconfig.js

@@ -0,0 +1,34 @@
+module.exports = function (grunt) {
+    /**
+     Example Gruntfile.js entry:
+
+     amberconfig: {
+       options: {
+         root_dir: process.cwd(), //optional
+       },
+       app: {
+         dest: 'config.js' //required
+       }
+     }
+     */
+
+    grunt.registerMultiTask('amdconfig', 'Build amd config of AMD project', function () {
+        // mark task as async task
+        var done = this.async();
+
+        var options = this.options({
+            root_dir: '.'
+        });
+
+        if (this.files.length === 0) {
+            grunt.fail.warn('No destination file specified.');
+        }
+        if (this.files.length > 1) {
+            grunt.fail.warn('Only one destination file supported.');
+        }
+
+        require('../lib/config.js').writeConfig(options.root_dir, this.files[0].dest, function (err) {
+            done(!err);
+        })
+    });
+};