This is a simple question that I'm having trouble finding an answer to. I'm just beginning to use docpad to build a site. I've encountered the following line in the HTML5 Boilerplate skeleton:
<%- @getBlock('styles').add(["/style.css"]).toHTML() %>
Does anyone know what this does. The endpoint is that it outputs the following html:
<link rel="stylesheet" href="/style.css" />
But I'm unsure what is going on under the hood here and why this simple css link is produced in this manner rather.
Any illumination would be greatly appreciated.
Update
After playing with this a bit, it seems that what @getBlock does is output a certain html code block. In this case, styles seems to specify the code. What would be nice to know, if this is correct, is what other blocks there are in Docpad, or whatever other framework this @getBlock function(?) comes from...
Founder of DocPad here.
Correct, getBlock
is part of the built in template helpers available to you. Several blocks are available, including scripts
, styles
and meta
. The purpose of these is to allow plugins and other templates to safely inject and interact with the contents of the blocks.
Such examples could be:
We're working really hard at improving the documentation and support systems, so apologies that this stuff wasn't clear before - but we're doing our best!