Getting Error message "No "concat" targets found" when running grunt-usemin

My grunt file is shown below:

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
            },
            build: {
                src: 'src/**/*.js',
                dest: 'dist/<%= pkg.name %>.min.js'
            }
        },
        watch: {
            js: {
                files: ['src/**/*.js'],
                options: {
                    livereload: '<%= connect.options.livereload %>'
                }
            },
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    'src/**/*.html',
                    'src/**/*.css',
                    'src/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },
        connect: {
            options: {
                port: 9000,
                livereload: 35729,
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    open: true,
                    // base: [
                    //     '.tmp',
                    //     ''
                    // ]
                    middleware: function(connect) {
                        return [
                            connect.static('.tmp'),
                            connect().use(
                                '/bower_components',
                                connect.static('./bower_components')
                            ),
                            connect().use(
                                '/app/styles',
                                connect.static('./app/styles')
                            ),
                            connect.static('src')
                        ];
                    }
                }
            }
        },
        copy: {
            app: {
                cwd: 'src', // set working folder / root to copy
                src: '**/*.html', // copy all files and subfolders
                dest: 'dist/', // destination folder
                expand: true
            },
            assets: {
                cwd: 'src', // set working folder / root to copy
                src: 'assets/*', // copy all files and subfolders
                dest: 'dist/', // destination folder
                expand: true
            }
        },
        useminPrepare: {
            options: {
                dest: 'dist'
            },
            html: 'src/index.html'
        },

        usemin: {
            html: ['dist/index.html']
        }

    });

    // Load the plugin that provides the "uglify" task.
    // grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-usemin');

    // Default task(s).
    grunt.registerTask('default', ['useminPrepare', 'copy', 'concat', 'uglify', 'usemin']);
    grunt.registerTask('serve', function(target) {
        grunt.task.run([
            'connect:livereload',
            'watch'
        ]);
    });

};

when i run grunt getting error message as "No "concat" targets found". I have been trying for 2 hours to solve this problem but no result pls help me to get the solution.

Answers


Way too late, but just in case it is useful for somebody else: I believe useminprepare will auto-generate a concat configuration and feed it to the grunt task runner, so above responses are not quite accurate I would say.

I would try reviewing the build blocks in src/index.html and check that the paths point properly to the resources that useminPrepare will concatenate. I'm struggling now with a problem like this :S

Reference here: https://github.com/yeoman/grunt-usemin


Use the following process to debug:

  • Run the sample project

  • Specify a temp storage location (temp or staging) directory

  • Before running usemin, make sure the temp or staging directory is not empty

  • If it is empty, run a grunt copy task which has the temp or staging directory set as the dest parameter

The main difference to be kept in mind, regarding directories and tasks, is that for useminPrepare, the directories needs to indicate the input, transient and output path needed to output the right configuration for the processors pipeline, whereas in the case of usemin it only reflects the output paths, as all the needed assets should have been output to the destination dir (either transformed or just copied).

References


Need Your Help

Dismiss PopupWindow on touch outside popup, without using deprecated constructor

android popupwindow

I have a PopupWindow and I wanted it to dismiss when the user touches outside, so I looked into and found out that I had to use popup.setBackgroundDrawable(new BitmapDrawable());. The problem is th...