vector_graphics icon indicating copy to clipboard operation
vector_graphics copied to clipboard

IMPROVEMENT: add an arg to skip non svg files

Open alefwd opened this issue 1 year ago • 1 comments

I have a folder /assets where I have a mix of svgs and json files, and I cannot change this. I would like to be able to apply the vector_graphics_compiler transformation to the folder. When I tried something like:

    - path: assets/
      transformers:
        - package: vector_graphics_compiler

I received exceptions relative to transforming the json files.

What I propose is either to skip non svg files by default, or to enable it using an arg:

    - path: assets/
      transformers:
        - package: vector_graphics_compiler
           args: ['--svg-only']

alefwd avatar Jul 30 '24 13:07 alefwd

I also run into this sometimes with files generated by the OS, very annoying. E.g. for .DS_Store:

Target debug_android_application failed: Error: User-defined transformation of asset "/Users/***/assets/vector/.DS_Store" failed.
Transformer process terminated with non-zero exit code: 1
Transformer package: vector_graphics_compiler
Full command: /Users/***/flutter/bin/cache/dart-sdk/bin/dart run vector_graphics_compiler --input=/var/folders/5l/cwy_qpwn32bf5r7qcnz2ns740000gn/T/flutter_tools.1xhZrW/.DS_Store-transformOutput0 --output=/var/folders/5l/cwy_qpwn32bf5r7qcnz2ns740000gn/T/flutter_tools.1xhZrW/.DS_Store-transformOutput1
stdout:
XXXXXXXXXXX /var/folders/5l/cwy_qpwn32bf5r7qcnz2ns740000gn/T/flutter_tools.1xhZrW/.DS_Store-transformOutput0 XXXXXXXXXXXXX
FileSystemException: Failed to decode data using encoding 'utf-8', path = '/var/folders/5l/cwy_qpwn32bf5r7qcnz2ns740000gn/T/flutter_tools.1xhZrW/.DS_Store-transformOutput0'
#0      _File._tryDecode (dart:io/file_impl.dart:615:7)
#1      _File.readAsStringSync (dart:io/file_impl.dart:624:7)
#2      IsolateProcessor._process.<anonymous closure> (file:///Users/***/.pub-cache/hosted/pub.dev/vector_graphics_compiler-1.1.11+1/bin/util/isolate_processor.dart:110:37)
isolate_processor.dart:110
#3      _RemoteRunner._run (dart:isolate:1090:47)
#4      _RemoteRunner._remoteExecute (dart:isolate:1084:12)
#5      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300:17)
#6      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

t-unit avatar Aug 09 '24 13:08 t-unit