When I’m working on a project, I don’t like to have to publish images just for prototypes, since I often end up throwing all the initial images away later. Also, I like being able to build a place directly from Rojo and start working locally. This way, someone can just pull the code from the project repository, run a script and start working.
Unfortunately, that workflow did not worked well when the project needed image assets… until now!
Wait, what's a tarmac?
If you don’t know about tarmac, it’s a tool that can automatically publish image files and generate a bunch of Lua files that returns the asset ID. For example, if you had a file named
game-logo.png, tarmac is able to publish the image and generate a Lua file (that’s called syncing) that looks like this:
-- This file was @generated by Tarmac. It is not intended for manual editing. return "rbxassetid://123456789"
With those files, you can require them in your code and apply them where you need. This is really useful if you’re working with Roact or if you’re generating UI with code in general.
I’ve forked tarmac and added a new way to sync the image assets locally (by copying the images into the content directory of Roblox Studio installation).
If you have cargo, you can install it with this command:
cargo install --git https://github.com/jeparlefrancais/tarmac.git --branch main
Now, to sync your assets locally:
tarmac sync --target local
It will generate Lua asset files that look like this:
-- This file was @generated by Tarmac. It is not intended for manual editing. return "rbxasset://.tarmac/project-name/image-asset-name.png"
The cool thing is that, once you’re satisfied with the current images you have, you can still use tarmac to publish them to Roblox without having to change any code. Tarmac will just generate new files and replace the asset ID.
If you are interested, source code is over here: https://github.com/jeparlefrancais/tarmac/tree/local-sync
One other feature I’ll probably add is to be able to sync audio files locally. Let me know if you think that would be useful