Javascript 如何在构建时更新yeoman中的html路径

Javascript 如何在构建时更新yeoman中的html路径,javascript,angularjs,gruntjs,yeoman,yeoman-generator-angular,Javascript,Angularjs,Gruntjs,Yeoman,Yeoman Generator Angular,我刚刚学习了约曼和格伦特。我已经使用yeoman angular generator创建了一个标准的角度项目。我希望我的文件夹结构按功能而不是按类型。例如,我在app/products/productlist.html和app/customers/customerlist.html中有html。在构建时,我希望将此html放在dist/templates文件夹中。我如何告诉grunt相应地更新html引用。图像也是如此。我将图像放在app/assets/images中,但在构建时我想将其放在di

我刚刚学习了约曼和格伦特。我已经使用yeoman angular generator创建了一个标准的角度项目。我希望我的文件夹结构按功能而不是按类型。例如,我在app/products/productlist.html和app/customers/customerlist.html中有html。在构建时,我希望将此html放在dist/templates文件夹中。我如何告诉grunt相应地更新html引用。图像也是如此。我将图像放在app/assets/images中,但在构建时我想将其放在dist/images文件夹中。

您需要熟悉节点的核心API

在你的情况下,让我知道

下面是一个如何将一个文件从一个目录复制到另一个目录的示例

var fs = require('fs'); //load file system module.
//create a writeable stream to your new file.
var out = fs.createWriteStream(path.join(__dirname, './B/file.js'));
//create a read stream from old file and pipe it to new file.
fs.createReadStream(path.join(__dirname, '/A/file.js')).pipe(out);

瞧,你是个职业选手!现在如果你想抓取所有以.html结尾的文件。您必须使用fs.readdir进行操作。现在请注意,fs.readdir是一个异步函数,因此它的作用域不是您所期望的。我相信你可以找到很多关于这个主题的信息。

如果不知道你在Grunt中使用的是什么模块,就很难说。在我的Grunt设置中,它接受文件夹中的任何HTML文件及其子文件,并将它们移到上面。我建议使用类似于“app/components/”的结构,并设置Grunfile以将组件中的任何.html文件移到上面。