Grunt重命名不起作用 [英] Grunt rename not working
问题描述
我的目录结构如下所示:
-src /
----- pages /
----------...
-----...
-build
我的gruntfile包含以下任务:
复制:{
all:{
dest:<%= builddir%> /,
src:[src / ** / *。{yaml,yml,py,html,htm,json,css }],
rename:function(d,s){return d.replace(src /,);}
}
},
builddir: build /<%= pkg.name%> - <%= pkg.version%> - <%= date%>,
当我运行复制任务时,它将所有选定的文件复制到包含软件包名称,版本和生成日期的目录中,但它会复制整个src目录。而我只想复制src目录的内容,所以我试图使用 rename`属性从dest中删除 我今天才开始使用grunt,所以我可能会在这里冒出一个菜鸟错误。 My directory structure looks like this: My gruntfile contains the following task: When I run the copy task, it copies all the selected files into the directory containing the package name, version and build date, as expected, but it copies the entire src directory. while I only want to copy the contents of the src directory, so I'm trying to remove I've only started using grunt today, so I might be makiing a rookie mistake here. Hmm... I think all you need is the
这篇关于Grunt重命名不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! src /',该属性不起作用一些原因。
复制:{
all:{
expand:true,
dest:<%= builddir%> /,
src:[** / *。{yaml,yml,py,html,htm,json, css}],
cwd:src /
}
}
-src/
-----pages/
----------...
-----...
-build
copy: {
all:{
dest:"<%= builddir %>/",
src: ["src/**/*.{yaml,yml,py,html,htm,json,css}"],
rename:function(d, s){return d.replace("src/","");}
}
},
builddir: "build/<%= pkg.name %>-<%= pkg.version %>-<%= date %>",
src/' from dest using the
rename`property, which doesn't work for some reason.cwd
(current working directory) option. Unless you in fact want to flatten the files into a single directory.copy: {
all:{
expand: true,
dest:"<%= builddir %>/",
src: ["**/*.{yaml,yml,py,html,htm,json,css}"],
cwd: "src/"
}
}