Skip to main content

staticFileValue()v4.0.530

Returns a CodemodValue that is written as a staticFile() call when it is inserted into source code. The staticFile import is added if it is missing.

warning

Draft API: This API is experimental and may change.

static-file-value.ts
import {createElement, staticFileValue} from '@remotion/codemods'; const image = createElement({ component: 'Img', importPath: 'remotion', props: {src: staticFileValue('photo.png')}, });

Inserting image produces <Img src={staticFile('photo.png')} />.

The value is also accepted by updateNodeProps() and setCompositionDefaultProps(), and it can be nested inside arrays and objects.

Arguments​

path​

The path of the file relative to the public folder, using forward slashes.

Return value​

A string. Treat it as opaque and pass it as a prop value.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​