What is the the difference between blocks and using include when you are creating Jade templates? When do you use one over the other?
A block is a placeholder. Its content comes from another jade file. An include is a placeholder, too. Its content also comes from another jade file.
So far, both are equal.
But:
include embeds a complete file. The including file defines which file is being included. Hence include is fine for outsourcing parts such as a footer or a header, which are always loaded the same way.
A block just defines a placeholder in the top file. Which content is included is not defined by this file, but by a sub-file. So, control over what is included is being reversed.
With an include, A says: Import B. With a block, B says: Here is content for a placeholder, and please use file A and its placeholders to fill in my content.
include means top-down, blocks mean bottom-up.
Additionally, one file may include several blocks.
When to use what:
Does that help?