Integration of the Grunt-Frontend- with the Maven-Backend-Project
[examples/maven-grunt-integration] / Gruntfile.js
1 module.exports = function(grunt) {
2
3   grunt.loadNpmTasks('grunt-newer');
4
5   grunt.registerTask('frontend','Build HTML & CSS for Frontend', function() {
6     var
7     done = this.async(),
8     path = './src/main/frontend';
9
10     grunt.util.spawn({
11       cmd: 'npm',
12       args: ['install'],
13       opts: { cwd: path, stdio: 'inherit' }
14     }, function (err, result, code) {
15       if (err || code > 0) {
16         grunt.fail.warn('Failed installing node modules in "' + path + '".');
17       }
18       else {
19         grunt.log.ok('Installed node modules in "' + path + '".');
20       }
21
22       process.chdir(path);
23       require(path + '/Gruntfile.js')(grunt);
24       grunt.task.run('newer:copy');
25       grunt.task.run('newer:less');
26       grunt.task.run('newer:svgstore');
27
28       done();
29     });
30   });
31
32
33   grunt.registerTask('default', [ 'frontend' ]);
34
35 };