Search code examples
angularjsgrunt-contrib-uglifyng-annotate

grunt-ng-annotate all angularjs files


I want to run ng-annotate via grunt on all my project's angular files.
Could not find this option.

I only have the option annotate by specify file name.

ngAnnotate: {
        dist: {
            files: {
                'output_file_name.js': ['input_file_name'],
            },
        }
    }

I need something more generic that would run recursively on a specific directory.


Solution

  • You can use the other configuration to go through folders and annotate each file which will be outputted in a *.annotated.js file.

    ngAnnotate: {
        dist: {
            files: [{
                    expand: true,
                    src: ['**/*.js', '!**/*.annotated.js'],
                    ext: '.annotated.js',
                    extDot: 'last'
                }],
        }
    }