All Projects → CaiJingLong → flutter_resource_generator

CaiJingLong / flutter_resource_generator

Licence: MIT license
Generate an R file for mapping all assets. Supports preview of image.

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to flutter resource generator

AssetLens
Asset Lens : Unity asset reference management utility working in background. 에디터 백그라운드에서 관리되는 유니티 에셋 파일 레퍼런스 데이터 도구.
Stars: ✭ 47 (-31.88%)
Mutual labels:  asset
Asset
The Asset component manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files.
Stars: ✭ 2,771 (+3915.94%)
Mutual labels:  asset
Utinyripper
GUI and API library to work with Engine assets, serialized and bundle files
Stars: ✭ 1,871 (+2611.59%)
Mutual labels:  asset
TACTIC-Handler
PySide based TACTIC client for maya, nuke, 3dsmax, houdini, etc
Stars: ✭ 67 (-2.9%)
Mutual labels:  asset
Jekyll
Call of Duty XAsset exporter that dumps raw assets from a game's memory.
Stars: ✭ 29 (-57.97%)
Mutual labels:  asset
n-asset-macro
Asset macro for Latte and Nette Framework for assets cache busting.
Stars: ✭ 14 (-79.71%)
Mutual labels:  asset
Galaxia-Runtime
Galaxy generator for Unity 3D, with Custom Particle Distributors, DirectX 11 Particles and Highly customization, curve driven Generation.
Stars: ✭ 36 (-47.83%)
Mutual labels:  asset
Hyde
Call of Duty XAsset compiler that transforms raw assets into digestible data.
Stars: ✭ 15 (-78.26%)
Mutual labels:  asset
codechain-exchange
A decentralized exchange platform for CodeChain
Stars: ✭ 16 (-76.81%)
Mutual labels:  asset
RxAssetManager
An RxJava2 implementation of the Android AssetManager.
Stars: ✭ 53 (-23.19%)
Mutual labels:  asset
unity-scene-groups
Adds a scene group asset to Unity Engine that allows for seamless opening of multiple scenes at once.
Stars: ✭ 33 (-52.17%)
Mutual labels:  asset
muleify
Muleify - Static Site Generator | Website Bundler | Asset Compiler | Templating | Preproccessor
Stars: ✭ 16 (-76.81%)
Mutual labels:  asset
node-inline-assets
Node API, CLI and Grunt Task for inlining external assets of HTML/CSS files
Stars: ✭ 18 (-73.91%)
Mutual labels:  asset
UnityBuildManager
Utility for running builds sequence & pushing them to markets & keeping changelog
Stars: ✭ 53 (-23.19%)
Mutual labels:  asset
pegnet
pegnet.org
Stars: ✭ 41 (-40.58%)
Mutual labels:  asset
phaser-manifest-loader
Phaser Manifest Loader
Stars: ✭ 28 (-59.42%)
Mutual labels:  asset

flutter_asset_generator

English | 中文文档

Automatically generate the dart file for pubspec.yaml

The purpose of this library is to help flutter developers automatically generate asset corresponding dart files to help developers release their hands from this meaningless job, and the open source community has a lot of the same functionality.

This library is based on dartlang's build library.

screenshot

img

Usage

Run from source

Add dart to your $PATH environment.

git clone https://github.com/fluttercandies/flutter_asset_generator
cd flutter_asset_generator
dart pub get
dart bin/asset_generator.dart $flutter_project

Run from pub global

  1. Install using pub global:
dart pub global activate flutter_asset_generator
  1. Run below commands: fgen or fgen -s $flutter_project

Support options

Use $ fgen -h or $ fgen --help see usage document.

fgen -h
-w, --[no-]watch    Continue to monitor changes after execution of orders.
                    (defaults to on)

-p, --[no-]preview  Generate file with preview comments.
                    (defaults to on)

-o, --output        Your resource file path.
                    If it's a relative path, the relative flutter root directory
                    (defaults to "lib/const/resource.dart")

-s, --src           Flutter project root path
                    (defaults to ".")

-n, --name          The class name for the constant.
                    (defaults to "R")

-h, --[no-]help     Help usage

-d, --[no-]debug    debug info

File name

Space, '.' and '-' in the path will be converted to _. @ will be converted to _AT_.

convert filed name example:

images/1.png => IMAGES_PNG
images/hello_world.jpg => IMAGES_HELLO_WORLD_JPG
images/hello-world.jpg => IMAGES_HELLO_WORLD_JPG

Errors will occur in the following situations:

images/
├── main_login.png
├── main/
    ├── login.png

Because the two field names will be exactly the same.

Config file

The location of the configuration file is conventional. Configuration via commands is not supported. The specified path is fgen.yaml in the flutter project root directory.

exclude and include rules

The file is yaml format, every element is glob style.

The name of the excluded file is under the exclude node, and the type is a string array. If no rule is included, it means no file is excluded.

The include node is the name of the file that needs to be imported, and the type is a string array. If it does not contain any rules, all file are allowed.

In terms of priority, exclude is higher than include, in other words:

First import the file according to the include nodes, and then exclude the files.

Example

exclude:
  - "**/add*.png"
  - "**_**"

include:
  - "**/a*.png"
  - "**/b*"
  - "**/c*"
assets
├── address.png           # exclude by "**/add*.png"
├── [email protected]        # exclude by "**/add*.png"
├── bluetoothon-fjdfj.png
├── bluetoothon.png
└── camera.png

images
├── address space.png     # exclude by "**/add*.png"
├── address.png           # exclude by "**/add*.png"
├── addto.png             # exclude by "**/add*.png"
├── audio.png
├── bluetooth_link.png    # exclude by **_**
├── bluetoothoff.png
├── child.png
└── course.png
/// Generate by [asset_generator](https://github.com/fluttercandies/flutter_asset_generator) library.
/// PLEASE DO NOT EDIT MANUALLY.
class R {
  const R._();

  /// ![preview](file:///Users/jinglongcai/code/dart/self/flutter_resource_generator/example/assets/bluetoothon-fjdfj.png)
  static const String ASSETS_BLUETOOTHON_FJDFJ_PNG = 'assets/bluetoothon-fjdfj.png';

  /// ![preview](file:///Users/jinglongcai/code/dart/self/flutter_resource_generator/example/assets/bluetoothon.png)
  static const String ASSETS_BLUETOOTHON_PNG = 'assets/bluetoothon.png';

  /// ![preview](file:///Users/jinglongcai/code/dart/self/flutter_resource_generator/example/assets/camera.png)
  static const String ASSETS_CAMERA_PNG = 'assets/camera.png';

  /// ![preview](file:///Users/jinglongcai/code/dart/self/flutter_resource_generator/example/images/audio.png)
  static const String IMAGES_AUDIO_PNG = 'images/audio.png';

  /// ![preview](file:///Users/jinglongcai/code/dart/self/flutter_resource_generator/example/images/bluetoothoff.png)
  static const String IMAGES_BLUETOOTHOFF_PNG = 'images/bluetoothoff.png';

  /// ![preview](file:///Users/jinglongcai/code/dart/self/flutter_resource_generator/example/images/child.png)
  static const String IMAGES_CHILD_PNG = 'images/child.png';

  /// ![preview](file:///Users/jinglongcai/code/dart/self/flutter_resource_generator/example/images/course.png)
  static const String IMAGES_COURSE_PNG = 'images/course.png';
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].