如何移动从文件src/documents/posts/post1.html
到out/post1.html
无子posts
出现在了目录?
我有一个子目录posts
在我documents
src/
documents/
index.html
contact.html
posts/
post1.html
post2.html
我希望的职位是在out/post1.html
不out/posts/post1.html
。
事实证明,你可以设定relativePath
属性为任何你想要的
@getCollection("html").findAllLive(..).on 'add', (document) ->
newRelativePath = document.get('relativePath').replace('posts/','')
document.set('relativePath', newRelativePath)
ImportantNote:
如果您使用的是findAllLive
蒙山,其中包括选择relativePath
,然后更改relativePath
,该文件会从集合中删除。 另外,您可以设置其他标志,并用它寻找。
@getCollection("html").findAllLive({$or:{relativeOutDirPath:'posts', isPost: true}}).on 'add', (document) ->
document.set('relativePath', newRelativePath)
.setMeta({isPost: true})