简体   繁体   中英

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.

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 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM