Spignite projects are common Node projects. You should be familiar with JavaScript eco-system - sorry, this tool is not for faint-hearted πͺ.
package.json
Create a new folder for your website. Create package.json that looks like this (common fields are omitted):
package.json
1
{
2
"scripts":{
3
"clean":"rm -rf out",
4
"dev":"node spig.js dev",
5
"build":"node spig.js"
6
},
7
"dependencies":{
8
"spignite":"^2.4.1"
9
}
10
}
Copied!
Nothing crazy, as you can see.
Spignite expects certain folder structure to be followed. We will talk more about it later; for now just keep in mind the whole site is defined in src subfolder.
Markdown content
Now, let's make some pages. Create the content for index page:
src/site/index.md
1
Hello **world**
Copied!
Templates
Spignite works with several template engines. Here we are going to use the awesome nunjucks:
src/layout/base.njk
1
<!doctypehtml>
2
<html>
3
<body>
4
{{ content | safe }}
5
</body>
6
</html>
Copied!
spig.js
The last thing is to run Spignite. Add the spig.js into your projects root:
spig.js
1
const{ Spig }=require('spignite');
2
β
3
Spig
4
.on('/**/*.md')
5
β
6
._('RENDER')
7
.pageLinks()
8
.render()
9
.applyTemplate()
10
;
11
β
12
Spig.run();
Copied!
This is the main program that runs Spignite. We will describe it in more details later. Still, it is quite clear that we define certain flow of operations over input files. Something like this:
1.
On all md files...
2.
in the RENDER phase...
3.
make page links (i.e. change .md to .html)...
4.
render all .md content...
5.
and apply the template.
Easy, right?
Run! π
That's all - execute the following in projects root and sit and enjoy the show!