As file count increases, Hexo spends more and more time generating the static HTML files using 'hexo g'. Why does Hexo reconstruct every single '.md' file, instead of limiting itself to the files modified?
My Hexo version is 3.0.1.
As file count increases, Hexo spends more and more time generating the static HTML files using 'hexo g'. Why does Hexo reconstruct every single '.md' file, instead of limiting itself to the files modified?
My Hexo version is 3.0.1.
It depends on several things, but the major bottlenecks are:
The author introduced fragment cache last year to cache static parts (header, footer, sidebar).
It is up to the theme author to use it to speed up page generation.
You could try changing to other themes and see if there is any different.
highlight.js will try to auto-detect language in code block if no language is specified since 3.0, which takes considerable time.
Consider using plain
and auto_detect
option (#1124) and see if there is any different.
It has been mentioned, but not committed, to use an incremental approach in generating the static HTML.
My workflow of using Hexo is:
- hexo serve
to preview you update
you modify iteratively in this step
using hexo-livereload
saves you actively reloading the page
- hexo generate
/hexo deploy
to publish your site
You're explicitly telling Hexo to rebuild every single post. Every time you add a new file, Node will take that much longer to interpret the .md files.
The command 'hexo -g' can be broken into two parts: 'hexo' states that you want Hexo to complete the following command. '-g' is an abbreviation of 'generate'. To use the word 'generate' without any modifiers is to tell Hexo that it should rebuild every post available in the Hexo folder.
In my limited experience, developers only use 'hexo -g' if they are:
If your computer can churn through .md files in reasonable time, then by all means use 'hexo -g.'
one of the easiest to improve performance problem causing components is the markdown stock renderer. fortunately there are lots of alternatives - for example, give hexo-renderer-markdown-it a shot:
$ npm un hexo-renderer-marked --save
npm i hexo-renderer-markdown-it --save