hexo icon indicating copy to clipboard operation
hexo copied to clipboard

Single File, Generate/ Deploy

Open rahil471 opened this issue 9 years ago • 10 comments

Can we only generate/deploy single file? Eg:

  • I run hexo deploy/generate once. (This renders everything)
  • Now I'm only modifying a single _posts (creating a new article or editing it).
  • Now instead of having me to do hexo generate again it would be great if I could just place that new/edited article.

rahil471 avatar Apr 18 '17 06:04 rahil471

You could do so via hexo render command, however, a new post may also affect the archive, category, rss, tag, and index pages. Therefore, the hexo generate will help to handle all these relations.

https://hexo.io/docs/commands.html#render

NoahDragon avatar Apr 18 '17 15:04 NoahDragon

Yes correct and that's why the render command does not suits my needs, also it does not apply the theme, only does a plain html conversion.

rahil471 avatar Apr 18 '17 17:04 rahil471

I got your idea. I thought renderer would apply the theme.

NoahDragon avatar Apr 18 '17 17:04 NoahDragon

Great Thanks! Would be great if you could provide me some pointers, I'll send a PR once done.

rahil471 avatar Apr 18 '17 17:04 rahil471

Glad you would like to contribute. I think you could start with the ConsoleRender. Probably add a flag to make it render with themes. https://github.com/hexojs/hexo/blob/master/lib/plugins/console/render.js

NoahDragon avatar Apr 18 '17 18:04 NoahDragon

Cool, thanks!

rahil471 avatar Apr 18 '17 18:04 rahil471

Moreover, you also could take a look at how generate command rendering a post.

https://github.com/hexojs/hexo/blob/4676ca23734884df87501a38bb16d7a64c582111/lib/hexo/index.js#L382-L390

NoahDragon avatar Apr 18 '17 18:04 NoahDragon

Great that helps!

rahil471 avatar Apr 18 '17 18:04 rahil471

Hey There, I'm half way through it. Got a question. view.render function takes in locals as a parameter, but in our case we only need to render a single file from the cli. So what should that parameter be set to?

rahil471 avatar Apr 24 '17 06:04 rahil471

I think it should set to the path and file data. https://github.com/hexojs/hexo/blob/4676ca23734884df87501a38bb16d7a64c582111/lib/hexo/index.js#L350-L354

NoahDragon avatar Apr 24 '17 19:04 NoahDragon