Atomic Design building block
myPage.js
var Template = require('molecule');
var myPage = new Template({
name : 'My Page'
, templateFile: './template.html'
})
myPage.render({foo:bar}, function(err, html){
...
});
template.html: (Dust syntax)
<html>
{@module id=".myhead" /}
{@module id="./examplebody" /}
</html>
- Modules are npm modules
- They can also point to a local js file.
./examplebody/index.js:
var Molecule = require('molecule')
var myHead = new Molecule({
template: "<head>{title}</head>"
, name : "head"
})
Etc. Etc.
Atoms, Organisms and Templates are just Molecules.