Grunt uglify找不到文件 [英] Grunt uglify not finding files
问题描述
- 开发
-js
- 页面
- js
- 页面
我试图把开发/ js / pages中的所有文件输出到js / pages并使用grunt uglify缩小它们,但仍然保留单独的文件 - 我不想将所有文件合并在一起。我尝试了以下方法:
build:{
src:'development / js / pages / *。js ',
dest:'js / page',
options:{
sourceMap:true,
compress:true,
mangle:true
}
}
但是这给了我一个错误:无法写入js / page文件
然后我尝试了这一点,这是在uglify文档上:
build:{
files:[{
cwd:'development / js / pages',
src:'* .js',
dest:'js / page'
}],
options:{
sourceMap:true,
compress:true,
mangle:true
}
}
但是这只是给了我在开发/ js /网页:
源文件filename.js找不到
然后另一个错误说目标(js / page)未被写入,因为源文件是空的。
任何想法为什么?
上面的选项几乎可以工作,但我需要删除选项块并在文件块中包含展开:
页面:{
文件:[{
expand:true,
cwd:'development / js / page',
src:'* .js',
dest:'js / page / ',
ext:'.min.js',
}]
}
I have the following directory structure:
--development
-js
-pages
--js
-pages
I'm trying to take all files in development/js/pages and output them js/pages and minify them using grunt uglify but still keep seperate files - I don't want to combine all the files together. I've tried the following:
build: {
src: 'development/js/pages/*.js',
dest: 'js/page',
options: {
sourceMap: true,
compress: true,
mangle: true
}
}
but this gives me an error: unable to write js/page file
Then I tried this, which is on the uglify documentation:
build : {
files: [{
cwd: 'development/js/pages',
src: '*.js',
dest: 'js/page'
}],
options : {
sourceMap: true,
compress: true,
mangle: true
}
}
but this just gives me this error for each file in development/js/pages:
source File "filename.js" not found
and then another error saying Destination (js/page) not written because the source files are empty.
Any ideas why?
For anyone else looking the second option above almost worked but I needed to remove the options block and include expand in the files block:
pages: {
files: [{
expand: true,
cwd: 'development/js/page',
src: '*.js',
dest: 'js/page/',
ext : '.min.js',
}]
}
这篇关于Grunt uglify找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!