Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding webfont build chain #24

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "dist"]
path = dist
url = https://github.com/bollwyvl/FiraCode.git
branch = gh-pages
1 change: 1 addition & 0 deletions dist
Submodule dist added at c97935
109 changes: 109 additions & 0 deletions jade/index.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
doctype html
html
head
meta(name="viewport"
content="width=device-width, initial-scale=1.0")
style.
@import url("css/FiraCode.css");
@import url("https://cdn.jsdelivr.net/g/codemirror(codemirror.css+theme/elegant.css),octicons,primer");

.CodeMirror {
font-family: "FiraCode-Regular";
height: auto;
margin-bottom: 10px;
}

.show-ligatures .CodeMirror {
text-rendering: optimizeLegibility;
-webkit-font-variant-ligatures: common-ligatures;
font-variant-ligatures: common-ligatures;
}

.toggle-ligatures-label {
color: #777;
}
.show-ligatures .toggle-ligatures-label {
color: #000;
}

body.show-ligatures
.container
h1: a(href="https://github.com/tonsky/FiraCode") Fira Code
h2 monospaced font
input.toggle-ligatures(type="checkbox", checked)
span.toggle-ligatures-label with programming ligatures

.columns
h3.one-fifth.column JavaScript
.four-fifths.column
textarea.javascript.
x == 0
el === document.body
true != false
true !== false
n >= 0
i <= Integer.MAX_INT
A.id <> NULL
true <=> false

h3.one-fifth.column Erlang
.four-fifths.column
textarea.erlang.
if L !== [] -> % Is L is not empty
sum(L) / count(L);
true -->
error
end.

-spec foo(integer())) -> integer().
foo(X) -> 1 + X

text(Foo)-->Foo.

qsort1([H | T)]) ->
qsort1([ X || x <- T, X < H ]) ++ [H] ++ qsort([ X || X <- T, X H ]).

h3.one-fifth.column go
.four-fifths.column
textarea.go.
func main() {
ch := make(chan int)
ch <- 1.0e10 // magic number
x, ok := <- ch
ok = true
defer fmt.Println(`exittingnow\`)
go println(le("hello world!"))
return
}

h3.one-fifth.column ruby
.four-fifths.column
textarea.ruby.
class Car < ActiveRecord::Base
has_many :wheels, :class_name => 'Wheel', :foreign_key => 'car_id'
scope :available, -> { where(available: true) }
end
omega = -> { 'alpha' }
alpha = ->(arg) { arg*2 }
hash = {1 => 'one', 2 => 'two'}

script(
src="https://cdn.jsdelivr.net/g/codemirror(codemirror.js+mode/javascript/javascript.js+mode/ruby/ruby.js+mode/haskell/haskell.js+mode/go/go.js+mode/ruby/ruby.js)"
)

script.
;(function(){
["javascript", "erlang", "go", "ruby"].map(function(lang){
CodeMirror.fromTextArea(
document.querySelector("." + lang),
{
mode: lang
}
);
});

var toggle = document.querySelector(".toggle-ligatures");
toggle.onchange = function(){
document.body.classList.toggle('show-ligatures');
}
}).call();
32 changes: 32 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "FiraCode",
"version": "0.0.0",
"description": "Webfonts for FiraCode, with programming ligatures",
"main": "index.js",
"scripts": {
"clean": "rm -rf dist/* && mkdir -p dist/fonts",
"cp": "cp FiraCode-Regular.ttf dist/fonts/ && cp -r scss dist/",
"woff": "./node_modules/.bin/ttf2woff FiraCode-Regular.ttf dist/fonts/FiraCode-Regular.woff",
"eot": "./node_modules/.bin/ttf2eot FiraCode-Regular.ttf dist/fonts/FiraCode-Regular.eot",
"svg": "./node_modules/.bin/ttf2svg FiraCode-Regular.ttf && mv FiraCode-Regular.svg dist/fonts/",
"sass": "./node_modules/.bin/node-sass ./scss/FiraCode.scss -o dist/css/",
"jade": "./node_modules/.bin/jade jade/*.jade -o dist/",
"build": "npm run clean && npm run cp && npm run woff && npm run eot && npm run svg && npm run sass && npm run jade"
},
"repository": {
"type": "git",
"url": "https://github.com/tonsky/FiraCode"
},
"author": "",
"license": "BSD",
"bugs": {
"url": "https://github.com/tonsky/FiraCode/issues"
},
"devDependencies": {
"ttf2woff": "~1.3.0",
"ttf2svg": "0.0.7",
"ttf2eot": "~1.3.0",
"node-sass": "~3.1.2",
"jade": "~1.9.2"
}
}
15 changes: 15 additions & 0 deletions scss/FiraCode.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$firacode-font-path: "../fonts";

@each $font-face in "FiraCode-Regular" {
@font-face {
font-family: $font-face;
font-style: normal;
font-weight: normal;
src: url('#{$firacode-font-path}/#{$font-face}.eot');
src: url('#{$firacode-font-path}/#{$font-face}.eot?') format('eot'),
url('#{$firacode-font-path}/#{$font-face}.woff') format('woff'),
url('#{$firacode-font-path}/#{$font-face}.ttf') format('truetype'),
url('#{$firacode-font-path}/#{$font-face}.svg') format('svg');
}
}