Skip to content

Multi path Configuration

Birju Vachhani edited this page Jul 30, 2020 · 1 revision

Spider provides supports for multiple configurations and classifications. If you wanna group your assets by module, type or anything, you can do that using groups in spider.

Example

Suppose you have both vector(SVGs) and raster images in your project and you want to me classified separately so that you can use them with separate classes. You can use groups here. Keep your vector and raster images in separate folder and specify them in the config file.

spider.yaml

groups:
  - path: assets/images
    class_name: Images
    package: res
  - path: assets/vectors
    class_name: Svgs
    package: res

Here, first item in the list indicates to group assets of assets/images folder under class named Images and the second one indicates to group assets of assets/vectors directory under class named Svgs.

So when you refer to Images class, auto-complete suggests raster images only and you know that you can use them with AssetImage and other one with vector rendering library.

Multi-path configuration

From Spider v0.4.0, multiple paths can be specified for a single group to collect references from multiple directories and generate all the references under single dart class.

Example

groups:
  - paths:
      - assets/images
      - assets/more_images/
    class_name: Images
    package: res
    types: [ .png, .jpg, .jpeg, .webp, .webm, .bmp ]

By using paths, multiple source directories can be specified. Above example will generate references from assets/images and assets/more_images/ under a single dart class named Images.

Clone this wiki locally