-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File Input or SymLinks #81
Comments
It would very much be a "nice to have" for now I just copy the files. Something like a comma seperation:
But again it is a "nice to have" but probably not in scope of this project because of this very uncommon usecase. |
This addresses an issue creating valid sprite names for symlinks, as detailed in issue #81. Symlinked files were being canonicalised, which caused a problem if the target was outside the base path. This change replaces the canonicalisation step with `std::path::absolute()`, which doesn't resolve symlinks and so they remain within the base path. The change has two side-effects: - It allows sprite names to be generated for non-existent files (a good thing, since there's no need for names to be linked to the filesystem) - It modifies the `spreet::sprite_name()` function to return a `PathError` instead of an `IoError` when the `abs_path` argument is not an ancestor of the `path` argument. Use of `std::path::absolute()` means the minimum supported Rust version (MSRV) is now 1.74.
Sorry for the slow reply, I haven’t had a chance to look at Spreet for a while.
If it helps, Spreet can be used as a library too, just as Spritezero can — but of course you need to write Rust rather than JavaScript. If that’s something you’re comfortable with then it’s quite possible to build a spritesheet from SVGs spread across multiple directories. You can use the same pattern as Spreet itself does (start with the code, for example).
Oops! This is a bug. It should definitely be possible to use symlinked files. I’ve fixed this in 014ce64 and I’ll include it in the upcoming 0.12.0 release.
I’ve been thinking about this, and I think an interesting generic solution would be for Spreet to support using a config file. I like the idea of having a TOML file that would allow you to define multiple spritesheets that could be generated in one go. Hypothetically, something like: [[sheets]]
ratio = 1
unique = true
minify-index-file = false
sprites = ["sprites/public", "sprites/version-a", "sprites/version-a/part-b"]
output = "[email protected]"
[[sheets]]
ratio = 2
unique = true
minify-index-file = false
sprites = ["sprites/public", "sprites/version-a", "sprites/version-a/part-b"]
output = "[email protected]" Then you could perhaps run Spreet like: spreet --config sprites.toml But that’s for another time 😄. Until then, I hope 014ce64 fixes your immediate problem. |
Thanks for making this library!
I previously used Spritezero in Javascript. Not the Spritezero-CLI version.
Here I could input a list of files instead of pointing to a folder.
Would it be possible to implement something like this?
I probably have a weird use case, where I can upload to 3 different folders, for example:
/sprites/public
/sprites/version-a
/sprites/version-a/part-b
where I want to generate a spritesheet for
part-b
, but including the sprites inpublic
andversion-a
.But not including
/sprites/version-a/part-a
.I tried to use Symbolic Links to create a new directory first
/sprites/temp
then create symbolic links to all .svgs.They work in other programs correctly.
But this gives me the error:
When i copy the files to the same folder, so no symlinks, they work correctly.
The text was updated successfully, but these errors were encountered: