to-file
This parser helps you generate files from any asset token: Bitmap, Font and Vector.
Interface
interface parser {
name: 'to-file';
options: {
filenameTemplate: string;
};
output: {
type: 'directory';
directoryPath: string;
};
};Options
Parameter
Required
Type
Default
Description
filenameTemplate
false
string
"{{parents}}/{{name}}[-{{mode}}]{{extension}}"
The mustache template used to generate the file path to write to the file system.
Available variables:
parents: group and collection names of the token's parents
name: the name of the asset token
mode: the name of the current mode
extension: the file extension extracted from the token
Basic usage
{
"fonts": {
"inter-regular": {
"$type": "font",
"$value": {
"default": {
"family": "Inter Regular",
"postScriptName": "Inter Regular",
"weight": "regular",
"style": "normal",
"files": [
{
"format": "ttf",
"url": "https://static.specifyapp.com/sdtf-seeds/inter-regular.ttf",
"provider": "Specify"
}
]
}
}
}
}
}{
"version": "2",
"repository": "@organization/repository",
// Only use the personalAccessToken when working with the CLI
"personalAccessToken": "<your-personal-access-token>",
"rules": [
{
"name": "Generate images",
"parsers": [
{
"name": "to-file",
"options": {
"filenameTemplate": "{{name}}{{extension}}"
},
"output": {
"type": "directory",
"directoryPath": "public"
}
}
]
}
]
}This will generate the corresponding font file binary, named after the filenameTemplate.
public/inter-regular.ttf
Last updated
Was this helpful?