搜尋套件、儲存庫與 APP 分類

套件詳情v1.0.2

font_mapper

一個 Dart 命令列工具,可自動掃描字型資源並更新您的 pubspec.yaml 檔案中的 `fonts:` 區段。

AndroidiOSmacOSWindowsLinux
近 30 天下載
40
喜歡數
9
Pub 分數
140

安裝套件

flutter pub add font_mapper

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Font Mapper 是一個 Dart CLI 工具,專為簡化 Flutter 項目中的字型資源管理而設計。它會自動掃描本機字型檔案,並更新 pubspec.yaml 檔案中的 `fonts:` 節點,消除手動設定的需求。對於擁有大量或經常變更字型的專案來說,這項工具極為理想,能確保一致性並減少設定時間。該工具支援所有主要平台,包括 Android、iOS、macOS、Windows 和 Linux,使其在各種開發環境中都具有高度彈性。透過與 Flutter 的建構流程無縫整合,Font Mapper 提升了開發者的工作效率,並減少設定錯誤。

適用情境

  • 自動註冊字體資源
  • 新增字型後更新 pubspec.yaml
  • 在團隊間保持一致的字體設定
  • 減少字體設定中的手動錯誤
  • 透過字體變更優化 CI/CD 工作流程

主要特色

  • 自動檢測專案中的字體檔案
  • 自動更新 pubspec.yaml
  • 支援多個平台
  • 命令列介面,方便整合
  • 保留現有的字型設定結構

適合對象

  • Flutter 開發人員管理多個字型
  • 需要一致字體設定的團隊
  • 涉及字體資源的 CI/CD 流水線
  • 尋求減少手動 pubspec 編輯的開發者
  • 頻繁更新字型的專案

使用建議

  • 需要命令列存取
  • 可能需要權限來修改 pubspec.yaml
  • 不適用於非 Dart 項目
  • 依賴於正確的字體檔案命名慣例
  • 應在共用倉庫中謹慎使用

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Font Mapper 🧩

A Dart CLI tool to scan font files and auto-generate the fonts: section in your pubspec.yaml.

🔧 Installation

dart pub global activate font_mapper

🚀 Usage

🔧 Basic
font_mapper

This scans assets/fonts and updates the fonts: section in pubspec.yaml.

🛠 With options
font_mapper -t pubspec.yaml -d assets/my_fonts

-t / --target: Target YAML file (default: pubspec.yaml)

-d / --dir: Directory containing font files (default: assets/fonts)

-h / --help: Show help

📂 Supported Fonts

.ttf, .otf formats

Supports multi-family directories

📄 Output Example

If you have:

assets/fonts/
├── SF-Pro-Display-BoldItalic.ttf
├── SF-Pro-Display-Regular.ttf
├── Inter-Light.otf

Running font_mapper generates:

flutter:
  fonts:
    - family: SF-Pro-Display
      fonts:
        - asset: assets/fonts/SF-Pro-Display-BoldItalic.ttf
          weight: 700
          style: italic
        - asset: assets/fonts/SF-Pro-Display-Regular.ttf
          weight: 400
    - family: Inter
      fonts:
        - asset: assets/fonts/Inter-Light.otf
          weight: 300

🔐 License

MIT License. See LICENSE.

🧑‍💻 Contributing

Feel free to open PRs or issues on GitHub!

Sponsoring

Buy Me A Coffee

OR

7ezgif-5-20a8a8001a

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。