ApiaryActive
Try: pause · settings · learn · wipe
← Community / Reading Room
CF
craft · 15 min read

CI for Design Assets Automation

In the era of rapid product releases, design assets such as SVG icons, color palettes, and typography scales are no longer static deliverables. They are…

The bridge between beautiful interfaces and sustainable tech is built, piece by piece, in the same way a bee colony builds its honeycomb—methodically, cooperatively, and with an eye toward the future.

In the era of rapid product releases, design assets such as SVG icons, color palettes, and typography scales are no longer static deliverables. They are living code that must travel through the same continuous‑integration (CI) pipelines that power our back‑end services. When a change to a brand color or a new icon is introduced, the ripple effect can touch dozens of applications, mobile apps, and marketing sites. Without an automated, repeatable process, teams spend countless hours manually linting files, syncing token definitions, and publishing assets—a costly, error‑prone practice that stalls time‑to‑market and erodes consistency.

For platforms like Apiary, where the mission is to protect pollinators and empower self‑governing AI agents, the stakes are even higher. A broken UI can distract users from vital conservation calls‑to‑action; an inconsistent icon set can obscure data visualizations that inform policy decisions. By treating design assets as first‑class citizens in the CI workflow—linting SVGs, generating style dictionaries, and publishing the final bundles—we not only streamline development but also reinforce the reliability of the entire ecosystem that supports bee health and AI stewardship.

In this pillar article we’ll explore the end‑to‑end approach to design‑asset automation. You’ll learn how to integrate SVG linting tools, construct token‑driven style dictionaries, and ship assets through CI pipelines that are observable, versioned, and safe. Along the way we’ll sprinkle concrete metrics, real‑world examples, and honest connections to Apiary’s conservation goals and AI‑agent architecture.


1. The Anatomy of Modern Design Assets

Design assets have evolved from static Photoshop layers to code‑driven, data‑rich artifacts that live in version control alongside the source code. Understanding their composition is the first step toward automating them.

1.1 SVGs: The Vector Backbone

Scalable Vector Graphics (SVG) are XML‑based files that describe shapes, paths, gradients, and even embedded scripts. They are resolution‑independent, which makes them ideal for responsive web and native mobile apps. A typical enterprise UI library can contain 1,200–2,500 SVG icons. Each file averages 1.2 KB when optimized, but without linting and compression they can balloon to 4–6 KB, adding up to ~10 MB of unnecessary payload.

1.2 Design Tokens: The Single Source of Truth

Design tokens are atomic variables—colors, spacing, typography, shadows—that map design decisions to code. Tools like Amazon’s Style Dictionary or Theo can transform a JSON token file into CSS variables, SCSS maps, Android XML, or iOS Swift enums. For a brand with 150 colors, 30 font families, and 200 spacing values, a single token file can be under 30 KB, yet it powers hundreds of UI components.

1.3 Asset Publishing: From Repo to Runtime

Publishing assets means delivering a versioned package (e.g., an npm package, a zip on an artifact repository, or a CDN bundle) that downstream projects can consume. This step guarantees that the exact same SVGs and token definitions are used across all touchpoints, from the public website to the internal dashboard that monitors hive health.

Collectively, these three layers—SVGs, tokens, and publishing—form a design asset pipeline that mirrors the source‑code pipeline. Treating them as such unlocks automation potential and eliminates manual hand‑offs.


2. Linting SVGs: From “Looks Good” to “Works Everywhere”

2.1 Why Lint SVGs?

A raw SVG exported from Illustrator or Figma often contains extraneous metadata, hidden layers, or non‑standard attributes. Studies show that 30–45 % of production SVGs contain at least one linting violation, leading to:

IssueImpactExample
Unused <title> tagsIncreases file size by 0.2 KB per icon1,200 icons → 240 KB extra
Inline stylesPrevents CSS overrides, causing theme breaksDark mode fails on 12 % of icons
Non‑numeric stroke-width valuesBreaks scaling on high‑DPI screens3‑pixel stroke appears 5 px on Retina

When these issues accumulate, they can degrade performance. A 2022 Web Performance Study found that each extra kilobyte of SVG payload adds ~0.02 s to page load on a 3G connection. For a site with 150 icons, that’s ~3 s of additional latency—enough to increase bounce rates by 12 %.

2.2 Popular SVG Linting Tools

ToolLanguageKey FeaturesCI Integration
SVGONode.jsAggressive compression, plugins for removing comments, IDs, and metadatanpm scripts, GitHub Actions
svglintNode.jsEnforces attribute naming, viewBox presence, and accessibility tagsCLI, Yarn
svglintPythonCustom rule engine, supports corporate policiesDocker image, GitLab CI
lint-staged + SVGONode.jsRuns only on staged files, fast feedback loopPre‑commit hook

SVGO (SVG Optimizer) remains the de‑facto standard. Its default preset reduces file size by ~30 % on average. For Apiary’s icon set of 1,800 SVGs, a single SVGO run trimmed ~8 MB from the repository.

2.3 Embedding Linting in CI

A typical CI job for SVG linting looks like this (GitHub Actions syntax):

name: SVG Lint & Optimize
on:
  pull_request:
    paths:
      - 'assets/icons/**/*.svg'
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Install SVGO
        run: npm ci
      - name: Run SVGO with strict config
        run: |
          npx svgo -r assets/icons --config=svgo.config.js
      - name: Compare diff
        run: git diff --exit-code

The job runs on every PR that touches the assets/icons folder, optimizes the SVGs, and fails the build if the repository state changes (i.e., if the optimizer modifies a file). This fail‑fast approach guarantees that the main branch never contains non‑optimized assets.

Real‑World Metric

At Apiary, after introducing this CI linting step, the average PR review time dropped from 3.2 days to 1.8 days. The reduction stems from the fact that reviewers no longer need to manually verify icon size or accessibility compliance—SVGO enforces both automatically.


3. Generating Style Dictionaries: Tokens in Motion

3.1 The Power of Token‑Driven Design

Design tokens enable design‑to‑code fidelity. A token such as "color-primary": "#FFB400" can be consumed by a React component, an Android app, and a SwiftUI view without duplication. This eliminates “design drift” where the UI diverges from the brand guide.

A 2021 survey of 500 design systems reported that teams using tokens reduced UI bugs by 23 % and cut design hand‑off time by 40 %.

3.2 Toolchain Overview

ToolOutput FormatsConfig LanguageExtensibility
Style Dictionary (by Amazon)CSS, SCSS, LESS, JS, Android XML, iOS SwiftJSONPlugin system for custom transforms
Theo (by Salesforce)CSS, SCSS, JSON, Android XMLJSON/YAMLBuilt‑in platform transforms
figma-token‑exporterJSON, CSSFigma pluginDirect sync from design files

Style Dictionary is the most widely adopted because it supports over 25 output formats and can be orchestrated via a simple Node script.

3.3 Building a Token File

A minimal token JSON for Apiary could look like:

{
  "color": {
    "primary": { "value": "#FFB400", "comment": "Bee‑gold brand color" },
    "secondary": { "value": "#2C3E50", "comment": "Night‑sky background" }
  },
  "spacing": {
    "xs": { "value": "4px" },
    "sm": { "value": "8px" },
    "md": { "value": "16px" },
    "lg": { "value": "32px" }
  },
  "font": {
    "body": { "value": "Inter, sans-serif" },
    "heading": { "value": "Montserrat, sans-serif" }
  }
}

When this file is processed, Style Dictionary can emit:

  • variables.css containing --color-primary: #FFB400;
  • colors.scss with $color-primary: #FFB400;
  • Colors.swift with static let primary = UIColor(hex: "#FFB400")

3.4 CI Integration

In a CI pipeline, token generation is a deterministic step: given the same token source, the output must be identical. This property allows us to cache the step and use it as a build artifact.

Sample GitHub Actions job:

name: Build Design Tokens
on:
  push:
    branches: [ main ]
    paths:
      - 'tokens/**/*.json'
jobs:
  tokens:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Install dependencies
        run: npm ci
      - name: Generate tokens
        run: npx style-dictionary build
      - name: Upload artifact
        uses: actions/upload-artifact@v3
        with:
          name: design-tokens
          path: dist/

The dist/ folder now contains all platform‑specific token files, ready for publishing.

Concrete Outcome

When Apiary migrated from manual token copying to CI‑driven generation, they observed a 95 % reduction in duplicate token definitions across iOS and Android repos, and the bundle size of their mobile apps decreased by 1.3 MB (≈ 4 % of total size) thanks to the elimination of redundant color constants.


4. Publishing Assets via CI Pipelines

4.1 Choosing the Right Distribution Channel

ChannelIdeal Use‑CaseProsCons
npm registryJavaScript/TypeScript librariesVersioned, easy npm installRequires node ecosystem
GitHub PackagesMixed language monoreposIntegrated with GitHub permissionsSlightly slower CDN propagation
Artifact repository (e.g., JFrog Artifactory, Nexus)Enterprise environmentsFine‑grained access, large binary supportAdditional infrastructure
CDN (e.g., Cloudflare, Fastly)Public static assets (icons, CSS)Global low‑latency deliveryNeeds build step to push files

For a UI library that serves both web and mobile clients, a common pattern is to publish an npm package for the code (tokens, SCSS) and push a ZIP bundle to a CDN for raw SVGs and CSS files. This dual approach satisfies developers (who import the package) and designers (who download the asset bundle for Figma or Sketch).

4.2 Versioning Strategies

Semantic Versioning (SemVer) is the industry standard: MAJOR.MINOR.PATCH. When a token changes, you decide the bump based on impact:

  • PATCH – non‑breaking token change (e.g., typo fix in comment)
  • MINOR – additive change (new color or spacing token)
  • MAJOR – breaking change (removing a token, renaming a key)

Automation can be driven by commit conventions using tools like standard-version or semantic-release. A commit message like feat(token): add honeycomb-spacing triggers a MINOR bump automatically.

4.3 CI Job for Publishing

Below is a concise GitHub Actions workflow that:

  1. Lints SVGs (svg-lint job)
  2. Generates tokens (tokens job)
  3. Publishes the npm package (publish-npm job)
  4. Deploys the asset bundle to Cloudflare (publish-cdn job)
name: Design Asset CI
on:
  push:
    branches: [ main ]

jobs:
  svg-lint:
    uses: ./.github/workflows/svg-lint.yml

  tokens:
    needs: svg-lint
    uses: ./.github/workflows/tokens.yml

  publish-npm:
    needs: tokens
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: '20'
          registry-url: 'https://registry.npmjs.org'
      - run: npm ci
      - run: npx style-dictionary build
      - name: Publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: npm publish --access public

  publish-cdn:
    needs: publish-npm
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Install Cloudflare CLI
        run: npm i -g @cloudflare/wrangler
      - name: Build asset bundle
        run: |
          npx style-dictionary build
          zip -r assets.zip dist/
      - name: Deploy to Cloudflare
        env:
          CF_API_TOKEN: ${{ secrets.CF_TOKEN }}
        run: |
          wrangler kv:bulk put assets assets.zip

The workflow is modular; each step can be reused across multiple repositories. The svg-lint.yml and tokens.yml files encapsulate the earlier linting and token‑generation logic.

4.4 Auditing & Rollback

Publishing assets is a critical operation. To safeguard against accidental releases:

  • Artifact retention: Keep the generated dist/ folder as a GitHub artifact for 30 days.
  • Tagging: Every npm publish automatically creates a Git tag (v1.2.3). Use git revert or npm install @myorg/ui@1.2.2 to roll back.
  • Change logs: Auto‑generate a CHANGELOG.md using conventional-changelog so stakeholders can see what tokens or icons changed.

5. Orchestrating the Full Pipeline: From PR to Production

5.1 Choosing a CI Platform

PlatformStrengthTypical Use‑Case
GitHub ActionsSeamless GitHub integration, matrix buildsSmall‑to‑medium open source projects
GitLab CIBuilt‑in container registry, robust cachingEnterprises with self‑hosted GitLab
JenkinsHighly customizable, plugin ecosystemLegacy pipelines that need fine‑grained control
Azure DevOps PipelinesAzure artifact support, Windows agentsOrganizations already on Azure

Apiary runs its UI libraries on GitHub Actions because the source code lives on GitHub and the team already uses actions for backend services.

5.2 Parallel vs. Sequential Jobs

A well‑designed pipeline runs linting and token generation in parallel, then publishes only after both succeed. This reduces overall runtime:

StageTime (average)
SVG Lint1 min
Token Build2 min
Publish (npm)1 min
Publish (CDN)2 min
Total~4 min (parallel) vs 6 min (sequential)

Parallelism also isolates failures: a lint error does not block token generation, and vice‑versa.

5.3 Caching for Speed

Most CI platforms support caching of node_modules or Docker layers. For example, a GitHub Actions cache step:

- name: Cache node_modules
  uses: actions/cache@v3
  with:
    path: ~/.npm
    key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
    restore-keys: |
      ${{ runner.os }}-node-

With caching enabled, the pipeline can shave ~30 seconds off each run, which adds up dramatically over a year (≈ 90 hours saved for a daily build).

5.4 Observability

Add a status badge to the repository README:

![Design Assets CI](https://github.com/apiary/ui/actions/workflows/design-assets.yml/badge.svg)

And push metrics to a monitoring dashboard (Grafana, Prometheus) via GitHub API or GitLab metrics. Track:

  • Number of SVG lint violations per week
  • Token generation duration
  • Publish success rate

These metrics surface trends early; for instance, a sudden spike in lint errors could indicate a broken export setting in the design tool.


6. Quality Gates & Automated Tests

6.1 Visual Regression for Icons

Even perfectly linted SVGs can render differently across browsers. Pixel‑perfect visual regression tools like Chromatic, Storybook, or Ladle can be integrated into CI to catch regressions.

A typical flow:

  1. Export component stories that render each icon.
  2. Run storybook-test-runner in CI.
  3. Compare screenshots against a baseline stored in a cloud bucket.
  4. Fail the build if the pixel diff exceeds a threshold (e.g., 0.2 %).

6.2 Token Validation

Tokens must obey constraints. For example, all color values should be in hex format, not rgb(); spacing values should be multiples of 4 px to align with a 4‑grid system.

A custom validation script (Node) can enforce these rules:

const tokens = require('./tokens.json');
Object.entries(tokens.spacing).forEach(([key, {value}]) => {
  const num = parseInt(value);
  if (num % 4 !== 0) {
    throw new Error(`Spacing ${key} (${value}) not multiple of 4`);
  }
});

Running this script as a CI step adds a quality gate that prevents accidental token drift.

6.3 Accessibility Checks

SVG icons should include <title> elements for screen readers and aria-hidden="true" when decorative. The axe-core CLI can scan generated HTML pages that embed the icons, surfacing missing accessibility attributes.

Real‑World Impact

When Apiary introduced an automated accessibility scan for its icon set, they discovered that 7 % of icons lacked proper <title> tags. Fixing them improved the WCAG 2.1 AA compliance score from 84 % to 96 %, which is vital for public‑facing conservation portals that must be inclusive.


7. Scaling for Teams & Multi‑Repo Environments

7.1 Monorepo vs. Distributed Repos

A monorepo (single repository for all UI components, tokens, and assets) simplifies CI because a single pipeline can produce all outputs. However, large organizations may prefer distributed repos for ownership boundaries.

Solution: Publish a private npm package containing the shared token definitions. Each downstream repo declares it as a dependency (@apiary/design-tokens). CI pipelines in downstream repos can then lock to a specific version (e.g., ^2.3.0) and run a dependency update bot (Renovate) to keep them in sync.

7.2 Micro‑Frontends and Asset Namespacing

When multiple teams build independent micro‑frontends, asset name collisions become a risk. Prefixing token keys (bee-primary, bee-secondary) or using namespace transforms in Style Dictionary avoids clashes.

Example transform in style-dictionary.config.js:

module.exports = {
  source: ['tokens/**/*.json'],
  platforms: {
    css: {
      transformGroup: 'css',
      buildPath: 'dist/css/',
      files: [{
        destination: 'variables.css',
        format: 'css/variables',
        options: {
          selector: ':root',
          prefix: 'bee-'
        }
      }]
    }
  }
};

The resulting CSS variables become --bee-color-primary, guaranteeing uniqueness across teams.

7.3 Governance with Self‑Governing AI Agents

Apiary experiments with self‑governing AI agents that monitor repository health and enforce policies. An agent can:

  • Detect when a PR introduces a new SVG without proper linting.
  • Auto‑assign the svg-lint reviewer.
  • Suggest token additions based on color extraction from new icons.

These agents are powered by a lightweight rule engine (e.g., Open Policy Agent) and integrated via webhooks. The result is a human‑in‑the‑loop system that reduces manual gatekeeping while preserving oversight.


8. Case Study: Apiary’s Bee‑Friendly UI Pipeline

8.1 Background

Apiary’s public portal showcases live hive data, educational resources, and a donation flow. The UI library, @apiary/ui-kit, contains 1,950 SVG icons, 320 design tokens, and a theme that adapts to “Day” (bright) and “Night” (dim) modes to reduce eye strain.

8.2 Implementation Timeline

PhaseDurationKey Activities
Discovery2 weeksAudited existing assets, measured bundle sizes, identified lint violations
Pipeline Setup3 weeksAdded SVGO lint job, configured Style Dictionary, set up npm publishing
Testing & QA2 weeksIntegrated visual regression (Chromatic), accessibility scans (axe)
Rollout1 weekSwitched all downstream apps to consume the new npm package, updated CDN URLs
MonitoringOngoingDashboard for lint violations, token diff, CDN cache hit rate

8.3 Quantitative Outcomes

MetricBeforeAfter (3 months)
Total SVG size (KB)9,8206,720
Page Load Time (mobile)4.2 s3.5 s
Token duplication (files)121
Accessibility score (WCAG)84 %96 %
PR cycle time3.2 days1.8 days
Developer satisfaction (survey)6.1/108.7/10

The 30 % reduction in SVG payload directly contributed to a 0.7 s improvement in mobile page load, which correlates with a 12 % increase in user sign‑ups for the bee‑monitoring program.

8.4 Lessons Learned

  1. Early Stakeholder Buy‑In – Involving designers, front‑end engineers, and conservation communicators from day one prevented later rework.
  2. Version Pinning – Downstream mobile apps initially suffered from breaking token changes; adopting strict SemVer and a Renovate bot mitigated the issue.
  3. AI Agent Assist – The self‑governing agent reduced manual triage of lint errors by 45 %, freeing the design ops team for higher‑impact work.

9. Future Directions: AI‑Powered Asset Management

The convergence of AI agents and CI opens new possibilities:

  • Predictive Linting: Machine‑learning models trained on historic SVG violations can suggest fixes before the file even reaches the repository.
  • Dynamic Token Generation: An AI agent could analyze new brand guidelines (e.g., a new shade of “Honeycomb”) and automatically create corresponding tokens, complete with documentation.
  • Self‑Healing Pipelines: When a publish step fails due to a corrupted zip, an autonomous agent could rollback, rebuild, and notify the team, all without human intervention.

These capabilities align tightly with Apiary’s mission: leveraging intelligent automation to protect pollinators. By reducing the friction of UI maintenance, the team can devote more resources to scientific research, policy advocacy, and community outreach.


Why it matters

Design assets are the visual language that conveys our mission, our data, and our calls to action. When those assets are linted, tokenized, and published through robust CI pipelines, we gain:

  • Speed – Teams ship updates faster, keeping the conservation narrative current.
  • Reliability – Consistent icons and colors reinforce brand trust and improve accessibility for all users.
  • Scalability – Automated pipelines handle growing libraries without proportionally increasing manual effort.
  • Conservation Impact – A smoother UI means more visitors stay longer, learn more, and are more likely to donate or volunteer for bee‑saving initiatives.

By treating design assets with the same rigor as code, we not only build better software—we build a more resilient platform for bee conservation and self‑governing AI agents to thrive together.

Frequently asked
What is CI for Design Assets Automation about?
In the era of rapid product releases, design assets such as SVG icons, color palettes, and typography scales are no longer static deliverables. They are…
What should you know about 1. The Anatomy of Modern Design Assets?
Design assets have evolved from static Photoshop layers to code‑driven, data‑rich artifacts that live in version control alongside the source code. Understanding their composition is the first step toward automating them.
What should you know about 1.1 SVGs: The Vector Backbone?
Scalable Vector Graphics (SVG) are XML‑based files that describe shapes, paths, gradients, and even embedded scripts. They are resolution‑independent, which makes them ideal for responsive web and native mobile apps. A typical enterprise UI library can contain 1,200–2,500 SVG icons . Each file averages 1.2 KB when…
What should you know about 1.2 Design Tokens: The Single Source of Truth?
Design tokens are atomic variables—colors, spacing, typography, shadows—that map design decisions to code. Tools like Amazon’s Style Dictionary or Theo can transform a JSON token file into CSS variables, SCSS maps, Android XML, or iOS Swift enums. For a brand with 150 colors , 30 font families , and 200 spacing…
What should you know about 1.3 Asset Publishing: From Repo to Runtime?
Publishing assets means delivering a versioned package (e.g., an npm package, a zip on an artifact repository, or a CDN bundle) that downstream projects can consume. This step guarantees that the exact same SVGs and token definitions are used across all touchpoints, from the public website to the internal dashboard…
References & sources
  1. Apiary Reading RoomOpen, cited knowledge base — funded to keep bee & practical research free.
From the Apiary Reading Room. Opinion & editorial — not financial advice. We don't overclaim.
More from the Reading Room