• Stars
    star
    680
  • Rank 64,805 (Top 2 %)
  • Language
    JavaScript
  • Created about 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Symbol font templates for Sketch.app

Symbols for Sketch Stories in Ready

Webfonts

This repo contains a set of templates to make a symbol font (icon font) with Sketch. What to do is ...

  1. Setup Tools
  2. Draw Icons
  3. Gulp!

Just 3 steps! Enjoy making your original fonts ;-)

Screenshot of Template

Requirements

Setup Tools

Node.js and gulp.js

You need some command line environments. But don't worry. Almost all will be done through GUI.

Go to http://nodejs.org/ and click the INSTALL link.

Node.js

Open the file downloaded and install it into your mac.

Install Node.js

Download this repo

Download this repo from GitHub. Extract it into the folder you like. e.g. /Users/yourname/Documents/your_icons

Open Terminal.app. You may find it at /Applications/Utilities/Terminal.app as you know.

Go to the folder in Terminal.app:

$ cd /Users/yourname/Documents/your_icons

Install some tools into the folder:

$ npm install

Sketch and Sketch Tools

You haven't got Sketch yet? Visit their site. It's worth more than its price tag. Sketch bundles CLI tool, too. You can use sketchtool command to extract the data from .sketch files.

Note: from ver 3.5, sketchtool has become an out-of-box feature. You don't have to install it seperately.

Draw Icons

It's time to draw your icons!

  • symbol-font-14px.sketch (default)
  • symbol-font-16px.sketch

There're two templates. Difference between these are just grid size. The template contains 32 artboards to draw each icon. Of cause you can add more artboards if you need.

Name convention

The name of the artboard is important. It define the name of not only the glyph but also the class of CSS.

  • icon_name: The character code will be assign automatically
  • uF701-icon_name: You can assign the code manually

The name of artboard

Gulp!

After saving your Sketch file, go back to Terminal.app again.

$ npm run symbols

Then check the dist directory. There'll be the font and CSS files generated.

Config

You can change the detail as you like. See the gulpfile.js and modify it.

To change the name or style of your font, it would be enough just changing the part below:

/**
 * Font settings
 */
 const fontName = 'symbols' // set name of your symbol font
 const className = 's' // set class name in your CSS
 const template = 'fontawesome-style' // or 'foundation-style'
 const skethcFileName = 'symbol-font-14px.sketch' // or 'symbol-font-16px.sketch'

Live reloading

Try the command below in Terminal.app. This time you will get the browser open automatically.

$ npm start

Then, keep the browser open and change your icon on symbol-font-*.sketch and save it. Boom! Magic will happen. The output inside the browser will be also changed. It's really really convenient. You must try it out.

CSS Styles

You can choose CSS Style templates, and make your own with lodash template.

(1) like Font Awesome

  • respect to: Font Awesome
  • template: css/fontawesome-style.css
<span class="s s-your_icon"></span>

(2) like Foundation

<span class="s-your_icon"></span>

Variants

for Android Apps

See variants/android directory.

Behind the scenes

We use gulp and some plugins.

To live-reload, we're using browser-sync.

Trouble Shooting

Case 1: Icons with circle 'filled' with black

Conditions like below.

  • Icons which has an inner symbol with a circle or a box outside
  • It seems OK with Chrome/Safari on Mac
  • Not OK with Safari on iOS, Chrome on Android
  • Not OK with IE on Windows

Solution: Revers Order of paths. See the screenshot below. Then Save and recreate the font.

Path Order

Case 2: Can't export CSS/HTML

gulp-iconfont has changed their API from v2 (June 2015), so we got to change our recipe a little bit.

  • Event name: codepoints to glyphs
  • Arguments passed: codepoint is equivalent to glyph.unicode[0].charCodeAt(0)

See more detail.

Case 3: Transformed items appear outside the artboard

Conditions:

  • rotated and/or transformed elements appear at wrong coordinates after export

Solution: Pipe gulp-imagemin before the iconfont task, which basically makes use of the SVG Optimizer and collapses multiple transformations.

History

  • 2.1.0:
    • Added: live reloading (finally found the solution in browser-sync)
    • Added: npm scripts. Now no need to install gulp globally
    • Changed: compatible with standard.js
  • 2.0.0: ES6, WOFF2, and adding variations (for Android app by @weitsai)
  • 1.2.0: Catch up versions, simplify the instruction
  • 1.1.0: Catch up to gulp-iconfont v2(svgicons2svgfont)

More Repositories

1

paper-css

Paper CSS for happy printing
CSS
2,443
star
2

gulp-sketch

A SketchTool plugin for gulp
CoffeeScript
300
star
3

riot-bootstrap

Bootstrap-like Components for Riot.js
JavaScript
136
star
4

felt

On-demand bundler for ES6 / CSS Next
JavaScript
118
star
5

keiyaku-css

Crazy Style Formatter for Japanese Contract Document
CSS
107
star
6

momy

MongoDB to MySQL replication
JavaScript
98
star
7

tokoro

住所緯度経度変換ライブラリ (ジオコーディング)
CoffeeScript
93
star
8

webdriverio-examples

JavaScript
64
star
9

ikki

An extention toolkit for Riot.js
JavaScript
53
star
10

symbols

The Template of Symbol Fonts for Web
CSS
48
star
11

symbol-font-in-web

CoffeeScript
48
star
12

gulp-slim

Slim plugin for gulp
CoffeeScript
44
star
13

ModernAqua-Theme-for-SugarCRM

MacOSX-like theme by CogniTom
CSS
20
star
14

gulp-straw

Gulp Task Manager: The command-line tool for managing your gulpfile.
CoffeeScript
17
star
15

Qiita

Articles on Qiita
14
star
16

shinkan.today

「新刊トゥデイ」
JavaScript
14
star
17

sankaku

三角かな配列 ― USキーボードでカナ入力
12
star
18

sometime-riot

Timepicker for Riot.js
JavaScript
12
star
19

riot-mixin-pack

JavaScript
12
star
20

coder2-docker

Dockerfile
10
star
21

west-or-east

郵便番号から、西日本か東日本を判定
JavaScript
9
star
22

wdio-phantomjs-service

WebdriverIO service to start & stop PhantomJS
JavaScript
8
star
23

riot-fa

Font Awesome icons for Riot.js
JavaScript
8
star
24

fafgag

Creates an Observable from FAFGAG (Function / Async Function / Generator / Async Generator)
JavaScript
8
star
25

es-http-error

HttpError class for browsers (without Node.js dependencies)
JavaScript
7
star
26

gulp-handbook

gulp.js Handbook
CoffeeScript
7
star
27

electron-starter

Electron Sample Application
CoffeeScript
7
star
28

gulpfiles

gulpfiles for gulp.js
CoffeeScript
6
star
29

gulp-phantom

PhantomJS plugin for gulp
CoffeeScript
6
star
30

comic-viewer

A comic viewer built on Riot.js
JavaScript
6
star
31

dominiq

A happy medium between classic DOMs and upcoming new ES features
JavaScript
5
star
32

riot-action

JavaScript
5
star
33

mornin

Check-in! Mornin'!
JavaScript
5
star
34

CAPITALS

CAPITALS illustrates how to attach source map to the code during compilation.
JavaScript
5
star
35

riotjs-currency-calculator

Riot.js Currency Calculator
CoffeeScript
4
star
36

bookreader.js

JavaScript
4
star
37

EventWall

JavaScript
4
star
38

SugarCE-JLP

Japanese Language Pack for SugarCE
PHP
3
star
39

dotfiles

Dotfiles without dotfiles
Shell
3
star
40

presentation-cmu12

CSS
3
star
41

riot-tutorial

HTML
3
star
42

entry

Sample app with Riot.js
JavaScript
3
star
43

riot-checker

Riot Tag Syntax Checker
HTML
2
star
44

felt-rollup

JavaScript
2
star
45

felt-recipe-minimal

Minimal recipe for Felt
JavaScript
2
star
46

felt-recipe-react

A recipe for Felt with React
JavaScript
2
star
47

felt-recipe-riot

A recipe for Felt with Riot
JavaScript
2
star
48

StaffRoll.net-Libraries-and-Themes

JavaScript
2
star
49

windmill

A keymap for 40% ortholinear keyboards.
C
1
star
50

mb_emulator

PHP
1
star
51

dali-example

JavaScript
1
star
52

CoffeeSugar

Helper functions written in CoffeeScript
1
star
53

Vagrant-LAMP-concrete5

A LAMP stack for Laravel using Vagrant with Chef
Ruby
1
star
54

canvas-lesson

1
star
55

CycleThroughWindows

1
star
56

wagon

Embed images into the CSS on the fly.
PHP
1
star
57

cognitom.github.com

public site
PHP
1
star
58

felt-postcss

JavaScript
1
star
59

devsync

Syncing npm modules while development
JavaScript
1
star