# sofyanach/emojitwo architecture

> Architecture diagram of the GitHub repository sofyanach/emojitwo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sofyanach/emojitwo
- Repository: https://github.com/sofyanach/emojitwo

## Overview

##### Project type and purpose
- This is an open-source asset pipeline and distribution tool for the Emojitwo emoji artwork (SVG, PNG, CSS, sprites). It takes raw emoji SVGs, applies metadata and templates, generates optimized raster assets and CSS sprites, and packages them for various package managers (npm, Bower, Composer, RubyGem).

##### File-structure analysis
- Top-level config/build files: Gruntfile.js, package.json, bower.json, composer.json, component.json, emojitwo.gemspec, .travis.yml
- Source assets:
- svg/ and svg_bw/ (raw SVG emoji files)
- emoji.json & emoji_strategy.json (metadata describing codepoints, variants, ordering)
- other/templates/ (Mustache templates for sprite generation)
- Build scripts and glue:
- index.js (Node module tying metadata and build tasks together)
- convert.bat (Windows helper)
- Grunt tasks invoking ImageOptim, spritesmith, mustache, etc.
- Outputs/distributions:
- png/ and png_bw/ (generated PNG files in multiple sizes)
- sprites/ (PNG sprite sheets + CSS, Mustache + CSS templates)
- css/ (prebuilt .css files for sprite usage)
- Documentation & CI:
- doc/ (HTML/MD docs, changelog, coverage)
- .travis.yml (continuous integration, test/coverage runs)

##### Essential elements
- Notes on external services or tools (ImageOptim, Travis CI)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Repository Layer
    subgraph "Repository"
        direction TB
        subgraph "Asset Sources"
            direction TB
            ASVG["svg/"]:::source
            click ASVG "https://github.com/sofyanach/emojitwo/tree/master/svg/"
            ASVGBW["svg_bw/"]:::source
            click ASVGBW "https://github.com/sofyanach/emojitwo/tree/master/svg_bw/"
            AMETA["emoji.json"]:::source
            click AMETA "https://github.com/sofyanach/emojitwo/blob/master/emoji.json"
            ASTRAT["emoji_strategy.json"]:::source
            click ASTRAT "https://github.com/sofyanach/emojitwo/blob/master/emoji_strategy.json"
            ATEMPL["other/templates/"]:::source
            click ATEMPL "https://github.com/sofyanach/emojitwo/tree/master/other/templates/"
            APALETS["other/palettes/"]:::source
            click APALETS "https://github.com/sofyanach/emojitwo/tree/master/other/palettes/"
        end

        subgraph "Build Engine"
            direction TB
            GFILE["Gruntfile.js"]:::build
            click GFILE "https://github.com/sofyanach/emojitwo/blob/master/Gruntfile.js"
            NGLUE["index.js"]:::build
            click NGLUE "https://github.com/sofyanach/emojitwo/blob/master/index.js"
            WHELP["convert.bat"]:::build
            click WHELP "https://github.com/sofyanach/emojitwo/blob/master/convert.bat"
            MUST["Mustache"]:::build
            SPRITE["spritesmith"]:::build
            IMGOPT["ImageOptim"]:::build
        end

        subgraph "Generated Outputs"
            direction TB
            PNG["png/"]:::output
            click PNG "https://github.com/sofyanach/emojitwo/tree/master/png/"
            PNGBW["png_bw/"]:::output
            click PNGBW "https://github.com/sofyanach/emojitwo/tree/master/png_bw/"
            SPRITES["sprites/"]:::output
            click SPRITES "https://github.com/sofyanach/emojitwo/tree/master/sprites/"
            CSS["css/"]:::output
            click CSS "https://github.com/sofyanach/emojitwo/tree/master/css/"
        end

        subgraph "Packaging & Distribution"
            direction TB
            PJSON["package.json"]:::output
            click PJSON "https://github.com/sofyanach/emojitwo/blob/master/package.json"
            BJSON["bower.json"]:::output
            click BJSON "https://github.com/sofyanach/emojitwo/blob/master/bower.json"
            CJSON["composer.json"]:::output
            click CJSON "https://github.com/sofyanach/emojitwo/blob/master/composer.json"
            COMPONENT["component.json"]:::output
            click COMPONENT "https://github.com/sofyanach/emojitwo/blob/master/component.json"
            GEMSPEC["emojitwo.gemspec"]:::output
            click GEMSPEC "https://github.com/sofyanach/emojitwo/blob/master/emojitwo.gemspec"
            npmReg["npm registry"]:::output
            bowerReg["Bower registry"]:::output
            composerReg["Composer registry"]:::output
            gemReg["RubyGem registry"]:::output
        end

        subgraph "Documentation & CI"
            direction TB
            DOCS["doc/"]:::doc
            click DOCS "https://github.com/sofyanach/emojitwo/tree/master/doc/"
            TRAVISCFG[".travis.yml"]:::doc
            click TRAVISCFG "https://github.com/sofyanach/emojitwo/blob/master/.travis.yml"
            TRAVIS["Travis CI"]:::doc
        end
    end

    %% Data Flows
    ASVG -->|reads SVGs| GFILE
    ASVGBW -->|reads SVGs| GFILE
    AMETA -->|reads metadata| NGLUE
    ASTRAT -->|reads strategy| NGLUE
    ATEMPL -->|reads templates| MUST
    APALETS -->|reads palettes| NGLUE

    GFILE -->|"invoke tasks"| NGLUE
    NGLUE -->|"generate unoptimized PNG"| PNG
    NGLUE -->|"generate BW PNG"| PNGBW
    NGLUE -->|"generate sprite templates"| SPRITES

    SPRITE -->|"create raw sprites"| SPRITES
    MUST -->|"render CSS"| CSS
    NGLUE -->|"calls ImageOptim"| IMGOPT
    IMGOPT -->|"optimize PNGs"| PNG
    IMGOPT -->|"optimize BW PNGs"| PNGBW

    PNG -->|"pack into packages"| npmReg
    PNGBW -->|"pack into packages"| bowerReg
    SPRITES -->|"pack into packages"| composerReg
    CSS -->|"pack into packages"| gemReg

    PJSON -->|"descriptor"| npmReg
    BJSON -->|"descriptor"| bowerReg
    CJSON -->|"descriptor"| composerReg
    COMPONENT -->|"descriptor"| npmReg
    GEMSPEC -->|"descriptor"| gemReg

    DOCS -->|"build docs & coverage"| TRAVIS
    TRAVISCFG -->|"CI config"| TRAVIS

    %% Styles
    classDef source fill:#cce5ff,stroke:#2a7ae2,color:#0c2d72
    classDef build fill:#d4edda,stroke:#27a844,color:#145d25
    classDef output fill:#fff3cd,stroke:#e09c00,color:#7a4f01
    classDef doc fill:#e2e3e5,stroke:#6c757d,color:#343a40
```
