Search code examples
angularjsgruntjsyeomanyeoman-generatoryeoman-generator-angular

use grunt and angular-generator to manage multiple projects


I am currently using yo generator-angular scaffold to create base for building a couple of projects sitting on identical code base.

I want to know if there's any good pointers that can allow me to use the grunt tools to perform two different builds without been verbose like grunttask:project1, and more specifically with ngminPrepare how can you build more than one project at the same time?

the end result im looking for is as this

$grunt build:project1
$grunt build:project2
$grunt test:project1
$grunt serve:project1

Solution

  • To do multiple builds simultaneously you can use grunt-concurrent: https://www.npmjs.org/package/grunt-concurrent

    You can just register a new task with the name you like:

    concurrent: {
        build: {
            tasks: ['build:project1','build:project2']
        }
    }
    
    grunt.loadNpmTasks('grunt-concurrent');
    
    grunt.registerTask('buildall', ['concurrent:build']);