hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
38.94k stars 4.77k forks source link

Single File, Generate/ Deploy #2519

Closed rahil471 closed 1 year ago

rahil471 commented 7 years ago

Can we only generate/deploy single file? Eg:

NoahDragon commented 7 years ago

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

rahil471 commented 7 years ago

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.

NoahDragon commented 7 years ago

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

rahil471 commented 7 years ago

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

NoahDragon commented 7 years ago

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

rahil471 commented 7 years ago

Cool, thanks!

NoahDragon commented 7 years ago

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

rahil471 commented 7 years ago

Great that helps!

rahil471 commented 7 years ago

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?

NoahDragon commented 7 years ago

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