Home

Awesome

<h1 align="center"> Blade <img src="https://travis-ci.org/jondot/blade.svg?branch=master" alt="Build Status" /> <br/> <img src="docs/blade-s.png" alt="Blade" /> </h1>

Automatically build and rebuild Xcode image catalogs for app icons, universal images, and more.

See blade-sample for a preconfigured project.

Why?

Because most of the time your image catalogs are the same image, resized to various sizes.

Here is how people solve this usually:

The problem with these solutions is:

Blade is an open source tool which will replace the PSD template and/or online services for you, and has a goal to satisfy the above requirements in the best way possible.

Quick start

You have 2 ways to install:

Homebrew

Using Homebrew:

 $ brew tap jondot/tap
 $ brew install blade

Release

Download one of the binaries in releases, and put in your PATH or just include in each Xcode project's root.

This should be a typical run of blade:

Use a Bladefile

Here's how a project setup with a Bladefile feels like (more in the Blade Sample repo):

The best way to use Blade, is to set up a local Bladefile for your entire project. Within it, specify all of your resources. Blade will pick it up automatically.

See blade-sample for a preconfigured project.

$ blade --init
Wrote Bladefile.

Here is how your Bladefile would look like:

blades:
  - source: iTunesArtwork@2x.png
    mount: foobar/Assets.xcassets/AppIcon.appiconset
  - source: Spaceship_1024.png
    mount: foobar/Assets.xcassets/Spaceship.imageset

It was made for this project structure:

foobar
├── Bladefile
├── images
│   ├── iTunesArtwork@2x.png
│   └── Spaceship_1024.png
├── foobar
│   ├── AppDelegate.swift
│   ├── Assets.xcassets
│   │   ├── AppIcon.appiconset
│   │   │   └── Contents.json
│   │   └── Spaceship.imageset
│   │       ├── Contents.json

Then use Blade (use --verbose if you want logs) within the same folder where your Bladefile lives:

$ blade --verbose
INFO[0000] Found a local Bladefile.
INFO[0000] Bladefile contains 2 blade defs.
...

And it will generate all of the images needed within each image catalog.

To make this happen before each build see how to run a script while building a product

Use directly

$ blade --source=iTunesArtwork@2x.png --template=templates/watch.json --out=out/watch --catalog

Here's what we did:

$ blade -s iTunesArtwork@2x.png -t existing.imageset -o existing.imageset

Here's what we did:

How does it work?

Blade parses the same Xcode image catalog configuration file as its own configuration source - no new concept introduced. This allows it to be future-proof with Xcode updates for new image sizes and catalog types.

Supported workflows:

Supported resize algorithms (-i or --interpolation flag):

See here for live samples.

Hacking on Blade

Pull requests are happily accepted.

Here's what you should know if you want to improve Blade:

Also, check out fixtures for quick image catalog configuration to work with.

Here is a typical flow:

  1. Clone project
  2. Branch off for your changes
  3. Edit code
  4. Test your changes, submit PR
  5. (release) make bump
  6. (release) make release
  7. (release) use hub to upload release binaries
  8. (release) make brew_sha ver=<current version>
  9. (release) update jondot/homebrew-tap version and sha to point to new binary

(* 'release' flows are done by core committers)

Contributing

Fork, implement, add tests, pull request, get my everlasting thanks and a respectable place here :).

Copyright

Copyright (c) 2015 Dotan Nahum @jondot. See MIT-LICENSE for further details.