A Rollup plugin which converts the ouput to After Effects compatible JSON for .jsx
files.
This plugin requires an LTS Node version (v8.0.0+) and Rollup v1.20.0+.
Using npm:
npm install rollup-plugin-ae-jsx --save-dev
Create a rollup.config.js
configuration file, import the plugin, and add it to the plugins
array:
import afterEffectJsx from "./rollup-plugin-ae-jsx";
import pkg from "./package.json";
export default {
input: "src/index.ts",
output: {
file: "dist/index.jsx",
format: "es",
},
external: Object.keys(pkg.dependencies),
plugins: [afterEffectJsx()],
};
- The output extension should be
.jsx
and formates
to ensure After Effects compatible files.rollup-plugin-ae-jsx
should be placed inplugins
after any other plugins.
Then call rollup
either via the CLI or the API.
- Creating a list of the exported functions and variables from the index file
- Removing non-compatible statements:
['ExpressionStatement', 'DebuggerStatement', 'ImportDeclaration', 'ExportNamedDeclaration'];
- Converting function and variable declarations into
.jsx
compliant syntax - Wrapping in braces (
{}
)