ssml-jsx

2.0.3 • Public • Published

ssml-jsx NPM Version

Write SSML inline within JavaScript. SSML is used in both Amazon Alexa and Google Home devices to provide tight control over device speech.

Setup

You can use SSML directly in source code by including babel-plugin-transform-jsx in your Babel configuration and importing ssml from ssml-jsx.

$ npm install --save-dev babel-plugin-transform-jsx
$ npm install --save ssml-jsx

.babelrc:

{
  "plugins": [
    ["transform-jsx", { "function": "ssml", "useVariables": true }]
  ]
}

Usage

import ssml, { renderToString } from 'ssml-jsx';
 
// Author SSML directly as JSX
const speechSSML = (
  <speak>
    <p>Hello world!</p>
    <break time='2s' />
    <p>What would you like to do today?</p>
  </speak>
);
 
// Render SSML to a string
const speechString = renderToString(speechSSML);

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i ssml-jsx

    Weekly Downloads

    11

    Version

    2.0.3

    License

    MIT

    Last publish

    Collaborators

    • cameronhunter