Last active
December 2, 2015 13:27
-
-
Save tilap/85a63835fb49e919bc15 to your computer and use it in GitHub Desktop.
Fontello in a project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Some Makefile commands and var to make use of fontello in a web project and use the | |
# Fontello website to directly setup and custom your custom fonticon | |
# | |
# See french explanation on http://tilap.net/integrer-fontello-dans-son-workflow-dev-pour-gerer-facilement-ses-icones-applicatifs/ | |
# Local / env var | |
FONT_DIR ?= ./src/browser/fonts/fontello | |
FONTELLO_HOST ?= http://fontello.com | |
FONT_TOKENFILE ?= .fontello | |
# Open fontello website with your project token (linux) | |
fontopen: | |
@if test ! `which xdg-open` ; then \ | |
echo 'xdg-open is required. Please install it to run this command (package xdg-utils)' >&2 ; \ | |
exit 128 ; \ | |
fi | |
@make fontgettoken | |
@xdg-open ${FONTELLO_HOST}/`cat .fontello` | |
# Open fontello website with your project token (mac, with chrome) | |
fontopenmac: | |
@make fontgettoken | |
@ cat $(FONT_TOKENFILE) | |
@ open -a "Google Chrome" ${FONTELLO_HOST}/`cat $(FONT_TOKENFILE)` | |
# Save the fonticon edited on fontello on your computer | |
fontsave: | |
@if test ! `which unzip` ; then \ | |
echo 'Install unzip first.' >&2 ; \ | |
exit 128 ; \ | |
fi | |
rm -rf .fontello.src .fontello.zip | |
curl --silent --show-error --fail --output .fontello.zip ${FONTELLO_HOST}/`cat $(FONT_TOKENFILE)`/get | |
unzip .fontello.zip -d .fontello.src | |
rm -rf ${FONT_DIR} | |
mv `find ./.fontello.src -maxdepth 1 -name 'fontello-*'` ${FONT_DIR} | |
rm -rf .fontello.src .fontello.zip | |
# Script shortcut to get a token for your local fontello package config | |
fontgettoken: | |
@curl --silent --show-error --fail --output $(FONT_TOKENFILE) --form "config=@${FONT_DIR}/config.json" ${FONTELLO_HOST} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment