Package Exports
- sambal
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sambal) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Sambal
Intro
Build fast and SEO friendly website with RxJs. Run inside a nodejs web server or CLI script. 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 sambalOr use with Sambal CLI for integrated dev server, javascript bundling, and static site generation
Example
const {template, render, pushSchemaOrgJsonLd, toSchemaOrgJsonLd, loadJsonLd, toHtml} = require("sambal");
const {from} = require("rxjs");
const {map} = require("rxjs/operators");
from(['https://www.imdb.com/title/tt1843866'])
.pipe(loadJsonLd()) // load json-ld from url or local drive. Supports html, json, md, or yml
.pipe(map(data => data[0]))
.pipe(pushSchemaOrgJsonLd(d => toSchemaOrgJsonLd(d, "Movie"))) // Add schema.org json-ld metadata to your HTML doc
.pipe(render(({css, name, actor}) => {
const classes = css.style({ // jss instance injected into render function
actor: {
"font-style": "italic"
}
});
// render HTML using javascript template literal
return template`
<html>
<body>
<h1>Movie name: ${name}</h1>
${actor.map(a => (template`
<span class="${classes.actor}">${a.name}</span>
`))}
</body>
</html>
`;
}))
.pipe(toHtml())
.subscribe(d => console.log(d));