Order of operations
What does Lume do to build your site?
This is a high level description of how Lume build your site. When you run lume, the following operations are executed in this order:
- Dispatch the event beforeBuild.
- Ensure the destfolder is empty.
- Walk the srcfolder recursively and load all files matching with a valid file extension, like.md,.njk, etc.- Skip files and folders starting with _,.or ignored withsite.ignore().
- If the file must be copied statically, calculate the source and destination paths.
- If the name of the file is _dataor is inside a_datafolder, is shared data.
- If it has a known extension, it's a page.
- Otherwise, ignore it.
 
- Skip files and folders starting with 
- Dispatch the event beforeRender.
- Group all pages by renderOrdervalue and sort them.
- For each group of pages with the same renderOrder:- If the page content is a generator, generate all the sub-pages.
- Calculate the final url.
- Run the preprocessors registered.
- Render the page using the assigned template engine and layout.
 
- Dispatch the event afterRender.
- Run the processors registered
- Dispatch the event beforeSave.
- Save all pages to destfolder.
- Dispatch the event afterBuild.
Watch mode
In watch mode (with lume --serve or lume --watch), the first build is exactly the same, but the successive changes have some differences:
- The destfolder is not emptied.
- Only the files with changes are reloaded.
- The steps 4 to 8 are exactly the same. All pages (not only the modified) are re-rendered. This is because a change in one file can affect to many pages, so we have to render all pages again.
- Only the pages that have changed its content are saved in dest.