@lottiefiles/relottie-stringify
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

relottie-stringify

npm npm bundle size npm npm

Compiler for unified. Serializes last syntax trees to LottieJSON

Use

yarn add @lottiefiles/relottie-stringify
import { unified } from 'unified';
import { visit } from 'unist-util-visit';

import type { Attribute } from '@lottiefiles/last';
import relottieParse from '@lottiefiles/relottie-parse';
import relottieStringify from '@lottiefiles/relottie-stringify';

const processor = unified().use(relottieParse).use(relottieStringify);

const tree = processor.parse('{"v":"5.5.7"}');

visit(tree, 'attribute', (node: Attribute) => {
  node.key = 'new_v';
});

const output = processor.stringify(tree);

output will equal

{"new_v":"5.5.7"}

dotLottie

You can use dotLottie.js for converting a LottieJSON into .lottie format

Security

As last properties can have expressions, and improper use of last can open you up to cross-site scripting cross-site scripting (XSS). Carefully assess each plugin and the risks involved in using them.

Contribute

Any contributions are welcome.

Acknowledgments

Legal

License © LottieFiles

Package Sidebar

Install

npm i @lottiefiles/relottie-stringify

Weekly Downloads

11,438

Version

1.4.0

License

MIT

Unpacked Size

17.5 kB

Total Files

31

Last publish

Collaborators

  • aidosmf
  • jawish
  • karamalie
  • sam-osb