grunt-contrib-uglify
grunt-contrib-uglify copied to clipboard
Error message if file not found
I miss some error or notification during the process if a js file from the sources was not found.
https://github.com/gruntjs/grunt-contrib-uglify/blob/master/tasks/uglify.js#L66
Are you sure you don't see any message?
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. :-/
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 .
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'
]
}
}
},
OK, confirmed.
/CC @sindresorhus
@featdd: this should do the job.
Still having this error. even verbose mode show nothing
Any update on this issue? Was a work-around ever found?
https://github.com/gruntjs/grunt-contrib-uglify/compare/warn-on-missing-input-files
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 I tried this and the filter only seems to run against files that exist. This was with [email protected] and [email protected]
Everyone's welcome to make a PR. Don't forget to CC me.