Code Monkey home page Code Monkey logo

royo's Introduction

Royo

What is Royo?

Royo is a general purpose Go app to serve SVG iconsets to your webapp or website. It has an extremely simple API that allows users to request a specific icon and, optionally, in a specific hex value.

Check out a sample Royo install using the excellent Unicorns icon set: https://serene-wildwood-49104.herokuapp.com/

What isn't Royo?

  • Royo isn't an icon pack.
  • Royo only serves monochromatic SVGs for now and will probably have unintended results if used otherwise

Getting Started with development

Dependencies

Installation

git clone https://github.com/almonk/royo
cd royo/
glide install
go run main.go

Royo will start automatically on port 8080 unless a PORT environment variable is set otherwise

Customising

Royo is configurable via royo_config.yaml:

# Name your icon service
service_name: "Unicorn Icon Set"
service_tagline: "A beautiful collection of open source icons"

# What hex value do you want to use if none is specified?
default_color: "0070D2"

# Where do your SVGs live?
icon_directory: "./imports/unicorns/"

Remember to restart the Go server after changing any configuration.

Customising documentation

Royo produces its own documentation which is served as the index page. Customising the documentation can be done by editing ./templates/index.html.

In this template the following variables can be used;

  • {{ .Icons }} is a map of all the Icons being served
    • Within the range;
    • {{ .Name }} is the addressable name of a single icon
    • {{ .Source }} is the raw SVG content
  • {{ .Name }} is the name of the iconset

Deployment

Royo ships as a Go binary, so you don't need to install Go or build anything to use it as-is. You can simply;

  • Add the icons you want to serve to ./imports/
  • Edit royo_config.yml to reflect your customisations

Then, find somewhere to deploy it!

Heroku

Royo comes with Heroku support out of the box. You just need an app to push to:

heroku create --buildpack https://github.com/ph3nx/heroku-binary-buildpack.git
heroku config:set HOST=0.0.0.0
heroku config:set PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/bin
git push heroku master

Docker

docker-compose build
docker-compose up

Todo

  • Add documentation for other hosting providers
  • Add CDN documentation

royo's People

Contributors

almonk avatar mginnard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mginnard

royo's Issues

Support fill color overrides with classes.

Desired Behavior

Allow the default fill color of the svg to be overridden by passing a class that defines a fill color to <img> (not just the hex query param).

Actual Behavior

A fill class passed to the <img> is overridden by the default fill color applied to each <path> in the svg.

Actual Behavior Example

See: https://codepen.io/mginnard/pen/8828e49115256b347eddcd04ad863f52?editors=1010

The fill-gray class is applied to the <img> tag, but it's overridden by the default fill color on the SVG being served by my royo service.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.