template generate static-resource

<!-- prettier-ignore-start -->

Generate a static resource.

Description for template generate static-resource

Generates the metadata resource file in the specified directory or the current working directory. Static resource files must be contained in a parent directory called "staticresources" in your package directory. Either run this command from an existing directory of this name, or use the --output-dir flag to create one or point to an existing one.

Aliases for template generate static-resource

force:staticresource:create

static-resource:generate

Flags

Flag Name (Long) Flag Name (Short) Description
<code>‑‑api‑version</code> N/A Type: Value<br><br>Override the api version used for api requests made by this command
<code>‑‑flags‑dir</code> N/A Type: Value<br><br>Import flag values from a directory.
<code>‑‑json</code> N/A Type: Boolean<br><br>Format output as json.
<code>‑‑name</code> <code>‑n</code> Type: Value<br>Required<br><br>Name of the generated static resource.<br><br>This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
<code>‑‑output‑dir</code> <code>‑d</code> Type: Value<br>Default value: .<br><br>Directory for saving the created files.<br><br>The location can be an absolute path or relative to the current working directory. The default is the current directory.
<code>‑‑type</code> N/A Type: Value<br>Default value: application/zip<br><br>Content type (mime type) of the generated static resource.<br><br>Must be a valid MIME type such as application/json, application/javascript, application/zip, text/plain, text/css, etc.

Examples for template generate static-resource

Generate the metadata file for a static resource called MyResource in the current directory:

sf template generate static-resource --name MyResource

Similar to previous example, but specifies a MIME type of application/json:

sf template generate static-resource --name MyResource --type application/json

Generate the resource file in the "force-app/main/default/staticresources" directory:

sf template generate static-resource --name MyResource --output-dir force-app/main/default/staticresources
<!-- prettier-ignore-end -->