I am trying to set up grunt to minify a number of js files in a src directory and copy them to a build directory. Following the grunt task documentation, I believe the below configuration should work.
uglify: {
dist: {
files: [
{
expand: true, // Enable dynamic expansion.
cwd: 'src/js/', // Src matches are relative to this path.
src: ['**/?.js'], // Actual pattern(s) to match.
dest: 'build/minified/', // Destination path prefix.
ext: '.min.js' // Dest filepaths will have this extension.
}
]
}
}
When I run grunt I get the message
Running "uglify:dist" (uglify) task Warning: Unable to write "build/minified" file (Error code: EISDIR). Use --force to continue.
If I switch the definition to use manual file paths it works fine. Is the documentation incorrect? or am I using it wrong?
I am running grunt v0.4.0rc2
Update grunt and replace src: ['**/?.js']
with src: ['**/*.js']
For more information see the guide on globbing patterns.
Had a similar issue where I was getting an issue loading files of the structure:
bower_components/Chart.js/Chart.min.js
Apparently grunt struggles with directories that contain .js
in them. I found this solution that fixed my problem: https://github.com/cbas/grunt-rev/issues/29
Basically you explicitly remove the problem directories in the rev section.
i.e, this works:
rev: {
files: {
src: [
'dist/**/*.js',
'!dist/bower_components/Chart.js',
]
}
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With