Giter Site home page Giter Site logo

robertohuertasm / figma-asset-downloader Goto Github PK

View Code? Open in Web Editor NEW
37.0 37.0 11.0 3.58 MB

๐Ÿ“ฆ Small utility to help you download Figma assets directly to your computer

Home Page: https://robertohuertasm.github.io/figma-asset-downloader/

License: MIT License

Rust 100.00%
assets-management cli design-systems figma figma-api figma-app figma-document

figma-asset-downloader's Introduction

Datadog

Hi there ๐Ÿ‘‹

I'm a software developer currenlty working at @Datadog. I enjoy programming (specially with Rust ๐Ÿฆ€), playing the saxophone ๐ŸŽท, and swimming ๐ŸŠ๐Ÿปโ€โ™‚๏ธ.

If you want to learn more:

Stats

Overall Stats Top Langs

figma-asset-downloader's People

Contributors

aliemjay avatar jordins avatar robertohuertasm avatar tsimbalar avatar vfabregat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

figma-asset-downloader's Issues

Feature request: possibility to use several document ids

We've been asked to support multiple document support.

This would basically imply that we can get files from more than one source.

The first implementation should deal with some cases:

  • what happens if the image name is repeated in several documents?
    • For the moment we overwrite the image.
    • It would be nice to log this or warn the user about this.
    • We discarded having a nested directory structure like 1x > doc1, > doc2, >doc3

`The provided configuration file was not found!` when not passing `-c` flag

If I launch fad with something like

fad -t <MY_PAT> -f <some_id> -d <another_id> -p downloaded -s 1 -e svg

It fails with :

โ›”   The provided configuration file was not found!
Error: No such file or directory (os error 2)

Expected outcome

It should just take into account the command line arguments and not look for a configuration file at all.

Context

Version 0.7.2 on macOS

Workaround

Current workaround is to create an empty fad.toml file with

touch fad.toml

Enhance the manifest by providing file size validation

It seems that optimization process is not deterministic causing some assets to be changed every time we do an import.

This can be partially solved by using git and detect this kind of things but it's a tedious job to do.

Ideally, the tool should be able to detect changes in file size and let the user know which images changed and how they changed (are they better optimized or not).

In a future feature, it may be nice that the user defines a threshold and depending on that, the tool automatially rolls back some of the changes.

Feature request: Avoid overwriting existing images

This requirement is related to #2

Ideally, the minimum implementation for this would require:

  • enable a flag in the tool options to let the user decide if she wants to overwrite or not the existing images. By default being false.
  • avoid saving to disk if the image already exists and the previous flag is true.

If we can use #2, we could then refine what else we could do with this feature.

Some related things to consider:

  • what happens when people only wants to override some specific images but not the rest of them? See #15
  • ideally, it would be nice to even avoid the call to the api if the image is already in the file system.

`-e svg` and `-p "assets/figma-images"` seem ignored when using a configuration file

Reproduction Steps

Given a file fad.toml such as :

personal_access_token = "my-top-secret-token"

When I run

fad -c "path/to/fad.toml" -f "aaaa" -d "123:456" -p "assets/figma-images" -e svg -s 1

to export files in svg format ...

Observed Behavior

In the output, I can see :

๐Ÿ”—  Getting URLs from...
๐Ÿ”— Url Collection  https://api.figma.com/v1/images/szptnuMeSOGeCZ0PJFFtg0?ids=9473:14599,9473:14699,[snip ...],10326:641&scale=1&format=png

notice the &format=png, and the files are downloaded

  • as png
  • in the downloads folder

Expected behavior

Files should be downloaded:

  • as svg
  • in the assets/figma-images folder

Context

With version 0.7.4 - macOS

`--personal-access-token` is required even when passing configuration file

Steps to reproduce

If I run fad like this :

fad -c "path/to/fad.toml" -f "xxx" -d "yyy:zzz" -p "assets/figma-images" -e svg -s 1

and my fad.toml looks like this :

personal_access_token = "top-secret-token"

Actual behavior

fad errors with :

error: The following required arguments were not provided:
    --personal-access-token <personal-access-token>

USAGE:
    fad --config-path <config-path> --document-id <document-id> --file-extensions <file-extensions>... --file-id <file-id> --file-scales <file-scales>... --path <path> --personal-access-token <personal-access-token>

Expected

fad should take the token from my configuration file if it is not provided through the CLI.

(i.e. my understanding is that we take values from the config file, and whatever is provided through CLI arguments overrides it)

Context

with fad v0.7.3 (i.e. the latest as of now) on macOS.

Feature request: allow to update list of files in manifest

When using the manifest, it can be a bit tedious initially to have to write in files the list of files we want.

It would be nice if there was a possibility to just populate this automatically from the list of existing files in the folder :).

By making it more automatic,

  • we reduce human mistakes and typos
  • we can enforce sorting, so that it overall creates smaller diffs in Version Control Systems

I could imagine this would behave like, say, snapshots in jest, or Approval Tests or "golden testing" in general where you would, by default, just validate "actual" against "expected", but be allowed to "accept" the changes, therefore updating the "expected".

So you could imagine a workflow like :

  1. run fad to download figma assets
  2. run validate-manifest to see what changed
  3. possibly previous step has failed because something has changed, so you'd run accept (or maybe interactively ?) to update the manifest with the new list.

Feature request : allow to generate initial manifest

When deciding to use the manifest to keep track of changes over time, it would be great to be able to generate the initial version.

I would expect something like

fad [all the flags and params] --create-manifest [manifest_filename=fad_manifest.toml]

and this would generate the manifest with :

  • the parameters that were passed (through CLI or config file) : paths, scale etc ...
  • an entry in files for each file that was downloaded from figma

I suspect it should complain (or just a warning ?) if the fad_manifest already exists so as not to overwrite it.

Support for images manifest

In order to avoid missing images and name changes, we thought of adding some sort of manifest where devs could make a list of images and dimensions that the tool could check.

By doing this, we could have immediate feedback of the export process and avoid to have to manually check the whole app looking for issues with the new images.

This should be optional, though.

Feature request: download individual assets

It would be great if we could download an individual asset based on its name, instead of having to download all the assets when we only want one. It would save us a lot of time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.