grunt-contrib-uglify icon indicating copy to clipboard operation
grunt-contrib-uglify copied to clipboard

Error message if file not found

Open featdd opened this issue 10 years ago • 12 comments

I miss some error or notification during the process if a js file from the sources was not found.

featdd avatar Jan 14 '15 10:01 featdd

https://github.com/gruntjs/grunt-contrib-uglify/blob/master/tasks/uglify.js#L66

Are you sure you don't see any message?

XhmikosR avatar Feb 17 '15 11:02 XhmikosR

I'm sure, always happens to me when I forgot to install bower components or something. I defined them as a source file in my grunt task but there is no notification of a non existing file. :-/

featdd avatar Feb 17 '15 12:02 featdd

Please share a minimum test case and I'll try to have a look. On Feb 17, 2015 2:58 PM, "Daniel Dorndorf" [email protected] wrote:

I'm sure, always happens to me when I forgot to install bower components or something. I defined them as a source file in my grunt task but there is no notification of a non existing file. :-/

— Reply to this email directly or view it on GitHub https://github.com/gruntjs/grunt-contrib-uglify/issues/284#issuecomment-74663755 .

XhmikosR avatar Feb 17 '15 14:02 XhmikosR

for example I deleted the jquery folder in my bower_components, but when it runs the task it just don't show the missing file

task:

uglify: {
    dist: {
        files: {
            'Resources/Public/js/scripts.min.js': [
                'bower_components/jquery/dist/jquery.min.js',
                'Resources/Private/Assets/js/main.js'
            ]
        }
    }
},

bildschirmfoto 2015-02-17 um 16 06 39

featdd avatar Feb 17 '15 15:02 featdd

OK, confirmed.

/CC @sindresorhus

XhmikosR avatar Feb 17 '15 16:02 XhmikosR

@featdd: this should do the job.

XhmikosR avatar Feb 18 '15 11:02 XhmikosR

Still having this error. even verbose mode show nothing

aldarund avatar Mar 14 '16 14:03 aldarund

Any update on this issue? Was a work-around ever found?

cobbdb avatar May 03 '16 21:05 cobbdb

https://github.com/gruntjs/grunt-contrib-uglify/compare/warn-on-missing-input-files

XhmikosR avatar May 05 '16 23:05 XhmikosR

See this solution https://github.com/gruntjs/grunt-contrib-concat/issues/57

Or this: https://gruntjs.com/configuring-tasks#custom-filter-function

module.exports = function(grunt) {
    function checkFile(filepath) {
        if (!fs.existsSync(filepath)) {
            grunt.fail.warn("file not found: " + filepath);
        }
        return true;
    }
{src: sources, dest: baseTarget + target, filter: checkFile}

juliusza avatar May 19 '17 11:05 juliusza

@juliusza I tried this and the filter only seems to run against files that exist. This was with [email protected] and [email protected]

moefinley avatar Jun 02 '17 13:06 moefinley

Everyone's welcome to make a PR. Don't forget to CC me.

XhmikosR avatar Jun 02 '17 14:06 XhmikosR