Transpiling
Once you have written your configuration in stsc
, you can transpile it to rhai
with the --transpile flag.
Usage example:
# long form
stsc --transpile ./path/to/file.stsc
# short form
stsc -t ./path/to/file.stsc
Other than providing just one stsc
file, you can provide multiple stsc
files as well! Just add them as well to the command.
Example:
# NOTE: you can also use the long form of `-t` which is `--transpile`
stsc -t ./path/to/file.stsc ./path/to/file2.stsc
The transpile command outputs the transpiled .rhai
files in the current directory which the command is ran. If you want to specify a specific directory which you want the .rhai
files to appear, then you can add the --out flag (or -o flag in short).
Example:
# long form
stsc -t ./path/to/file.stsc --out ./output_dir/
# short form
stsc -t ./path/to/file.stsc -o ./output_dir/
The transpiled code is unformatted by default and does not have whitespaces. StaticScript provides a simple experimental formatter that follows the KISS (Keep It Simple Stupid) principle. You can make the transpiled code be formatted before writing by using the --format (or -f) flag.
Example:
# long form
stsc -t ./path/to/file.stsc -o ./output_dir/ --format
# short form
stsc -t ./path/to/file.stsc -o ./output_dir/ -f