@orbito/render-client

0.0.4 • Public • Published

Orbito Render Client

npm (scoped) Github actions Build MIT license Typed

HTTP client to use with Orbito Render.

npm i --save @orbito/render-client
import { RenderClient } from '@orbito/render-client/RenderClient'

const renderClient = new RenderClient(
    {
        default: 'http://localhost:4264',
    }, {
        html: RenderClient.optimizeForHtml,
        email: RenderClient.optimizeForEmail,
    },
)

const styleId = 'main'

const res = await renderClient.render(
    'default', 'en', styleId,
    renderClient.tplRef('my-tpl', 'pages/default'),// the template reference
    renderClient.optimize('html'),// the optimization settings
    {},// data, available in template under `doc.*`
    {},// styleVars, configure Scss vars just in time
)
console.log('   > rendered template in ' + res.renderTime + 'ms')
const html = res.rendered

const resStyle = await renderClient.style(
    'default', styleId, 'my-tpl',
    {nanoCss: true, cssAutoPrefix: true},
    {},// styleVars, configure Scss vars just in time
)
console.log('   > generated style in ' + resStyle.styleTime + 'ms')

const style = resStyle.style

ESM only package

License

MIT License

© 2022 bemit

Readme

Keywords

none

Package Sidebar

Install

npm i @orbito/render-client

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

9.87 kB

Total Files

5

Last publish

Collaborators

  • elbakerino