Skip to content
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

Flutter SVG converter to .vec #36

Open
behzodfaiziev opened this issue Feb 5, 2025 · 0 comments
Open

Flutter SVG converter to .vec #36

behzodfaiziev opened this issue Feb 5, 2025 · 0 comments

Comments

@behzodfaiziev
Copy link
Owner

behzodfaiziev commented Feb 5, 2025

#!/bin/bash

# Define the input directory
INPUT_DIR="icons/filled"

# Define the output directory
OUTPUT_DIR="${INPUT_DIR}_vec"

# Check if the input directory exists
if [ ! -d "$INPUT_DIR" ]; then
  echo "Error: Directory '$INPUT_DIR' not found."
  exit 1
fi

# Check if the input directory is empty
if [ -z "$(ls -A "$INPUT_DIR")" ]; then
  echo "Error: Directory '$INPUT_DIR' is empty."
  exit 1
fi

# Create the output directory if it doesn't exist
if [ ! -d "$OUTPUT_DIR" ]; then
  echo "Creating output directory '$OUTPUT_DIR'..."
  mkdir -p "$OUTPUT_DIR"
fi

# Process each .svg file in the input directory
for svg_file in "$INPUT_DIR"/*.svg; do
  if [ -f "$svg_file" ]; then
    # Get the base filename (without path)
    base_name=$(basename "$svg_file")
    # Define the output file path
    output_file="$OUTPUT_DIR/${base_name}.vec"
    echo "Compiling $svg_file to $output_file..."
    dart run vector_graphics_compiler -i "$svg_file" -o "$output_file"
  fi
done

echo "All SVGs have been compiled to .vec files in '$OUTPUT_DIR'."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant