0.0.4 • Published 2 years ago

@orbito/render-client v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago