Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message if file not found #284

Open
featdd opened this issue Jan 14, 2015 · 12 comments
Open

Error message if file not found #284

featdd opened this issue Jan 14, 2015 · 12 comments

Comments

@featdd
Copy link

featdd commented Jan 14, 2015

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

@XhmikosR
Copy link
Member

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

Are you sure you don't see any message?

@featdd
Copy link
Author

featdd commented Feb 17, 2015

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. :-/

@XhmikosR
Copy link
Member

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
#284 (comment)
.

@featdd
Copy link
Author

featdd commented Feb 17, 2015

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

@XhmikosR
Copy link
Member

OK, confirmed.

/CC @sindresorhus

@XhmikosR
Copy link
Member

@featdd: this should do the job.

@aldarund
Copy link

Still having this error. even verbose mode show nothing

@cobbdb
Copy link

cobbdb commented May 3, 2016

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

@XhmikosR
Copy link
Member

XhmikosR commented May 5, 2016

@juliusza
Copy link

juliusza commented May 19, 2017

See this solution gruntjs/grunt-contrib-concat#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}

@moefinley
Copy link

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

@XhmikosR
Copy link
Member

XhmikosR commented Jun 2, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants