JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q39121F
  • License MIT

Write SSML inline within javascript files using JSX

Package Exports

  • ssml-jsx

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 (ssml-jsx) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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);