Sambal CLI
Intro
Build fast and SEO friendly website with RxJs. No new template syntax to learn, just pure Javascript template literal. Support schema.org vocabularies and json-ld (json linked data) format.
Installation
npm install --save-dev sambal-cli sambal
touch sambal.config.js
Sample sambal.config.js
const {from, of} = require("rxjs");
const {render, template} = require("sambal");
function sitemap() {
return from([
'/first-blog',
]);
}
function render({path, params}) {
return of({headline: "hello world"})
.pipe(render(({headline}) => {
return template`
<html>
<body>
<h1>${headline}</h1>
</body>
</html>
`;
}));
}
function sitemap() {
return from([
'/',
'/user/user123',
]);
}
module.exports = {
routes: [
{path: '/', render: render}, // REQUIRED. Array of routes. Path is an expressjs style path, render is a function of type ({path, params}) => Observable
{path: '/user/:username', render: render}
],
sitemap$: sitemap() // REQUIRED. Observable of all possible urls in your website.
};Generate static site
npx sambal buildStart dev server and reload browser on change event
npx sambal serveGenerate schema.org boilerplate type in yaml or json format
npx sambal schema.org <schema.org type> <output file> [-f, --full]For example,
npx sambal schema.org person person.yml
npx sambal schema.org blogposting blog.json