Integration of the Grunt-Frontend- with the Maven-Backend-Project
[examples/maven-grunt-integration] / Gruntfile.js
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644 (file)
index 0000000..a704356
--- /dev/null
@@ -0,0 +1,35 @@
+module.exports = function(grunt) {
+
+  grunt.loadNpmTasks('grunt-newer');
+
+  grunt.registerTask('frontend','Build HTML & CSS for Frontend', function() {
+    var
+    done = this.async(),
+    path = './src/main/frontend';
+
+    grunt.util.spawn({
+      cmd: 'npm',
+      args: ['install'],
+      opts: { cwd: path, stdio: 'inherit' }
+    }, function (err, result, code) {
+      if (err || code > 0) {
+        grunt.fail.warn('Failed installing node modules in "' + path + '".');
+      }
+      else {
+        grunt.log.ok('Installed node modules in "' + path + '".');
+      }
+
+      process.chdir(path);
+      require(path + '/Gruntfile.js')(grunt);
+      grunt.task.run('newer:copy');
+      grunt.task.run('newer:less');
+      grunt.task.run('newer:svgstore');
+
+      done();
+    });
+  });
+
+
+  grunt.registerTask('default', [ 'frontend' ]);
+
+};