我正在尝试设置 grunt 来缩小 src 目录中的多个 js 文件并将它们复制到构建目录。继grunt task documentation ,我相信下面的配置应该可以工作。
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.
}
]
}
}
当我运行 grunt 时,我收到消息
Running "uglify:dist" (uglify) task Warning: Unable to write "build/minified" file (Error code: EISDIR). Use --force to continue.
如果我将定义切换为使用手动文件路径,它可以正常工作。文档是否不正确?还是我用错了?
我正在运行 grunt v0.4.0rc2
最佳答案
更新 grunt 并将 src: ['**/?.js']
替换为 src: ['**/*.js']
有关详细信息,请参阅 globbing patterns 上的指南.
关于gruntjs - Grunt 多任务在构建时抛出 EISDIR 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14452751/