javascriptgruntjsgrunt-contrib-uglify

On Grunt run, receiving: "no "uglify" targets found


I have a Gruntfile.js setup as basic as it goes. It's creating the minified default file yet I'm receiving errors during running grunt task.

>>No "uglify" targets found.

Gruntfile.js

EDITED uglify out of concat.

'use strict';
module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        concat: {
            options: {
                separator: '\n'
            },
            dist: {
                src: ['node_modules/angular/angular.js', 'assets/js/modules/default.js'],
                dest: 'assets/js/dist/main.js'
            }
        },
            uglify: {
                options: {
                    banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */'+"\n"
                },
                    files: {
                        'assets/default.min.js': ['<%= concat.dist.dest %>']

                }
            }

    });
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.registerTask('default', ['concat', 'uglify']);
};

Please let me know what i'm doing wrong, thanks! Bud.


Solution

  • This is my simplified gruntfile, with just the necessary.

    module.exports = function(grunt) {
        grunt.initConfig({
            pkg: grunt.file.readJSON('package.json'),
            concat: {
                dist: {
                    src: ['app/Resources/app/src/*.js', 'app/Resources/app/src/**/*.js'],
                    dest: 'web/app/js/app.js'
                }
            },
            uglify: {
                app: {
                    src: ['web/app/js/app.js'],
                    dest: 'web/app/js/app-min.js'
                }
            }
        });
        grunt.registerTask('default', ['concat', 'uglify']);
    };
    

    hope it helps :)