Skip to content

Instantly share code, notes, and snippets.

@puzrin

puzrin/Makefile

Last active Oct 22, 2020
Embed
What would you like to do?
Makefile example for fontello.com API
# Edit here - set path to you directory with config.json & fonts
FONT_DIR ?= ./assets/vendor/fontello/src
### Don't edit below ###
FONTELLO_HOST ?= https://fontello.com
fontopen:
@if test ! `which curl` ; then \
echo 'Install curl first.' >&2 ; \
exit 128 ; \
fi
curl --silent --show-error --fail --output .fontello \
--form "config=@${FONT_DIR}/config.json" \
${FONTELLO_HOST}
x-www-browser ${FONTELLO_HOST}/`cat .fontello`
fontsave:
@if test ! `which unzip` ; then \
echo 'Install unzip first.' >&2 ; \
exit 128 ; \
fi
@if test ! -e .fontello ; then \
echo 'Run `make fontopen` first.' >&2 ; \
exit 128 ; \
fi
rm -rf .fontello.src .fontello.zip
curl --silent --show-error --fail --output .fontello.zip \
${FONTELLO_HOST}/`cat .fontello`/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
@AliLozano

This comment has been minimized.

Copy link

@AliLozano AliLozano commented Jun 29, 2017

For Mac, you can use pipe to use open

x-www-browser ${FONTELLO_HOST}/`cat .fontello` | open ${FONTELLO_HOST}/`cat .fontello`
@Pau1fitz

This comment has been minimized.

Copy link

@Pau1fitz Pau1fitz commented Jun 29, 2017

I am on a linux machine running ubuntu and when I run the makefile I get the following error:

$ make -f fontello.mk 
curl --silent --show-error --fail --output .fontello \
	--form "config=@./src/font/config.json" \
	http://fontello.com
x-www-browser http://fontello.com/`cat .fontello`
[25445:25481:0629/********:ERROR:browser_gpu_channel_host_factory.cc(103)] Failed to launch GPU process.
Created new window in existing browser session.

has anyone seen this before?

@sntran

This comment has been minimized.

Copy link

@sntran sntran commented Feb 17, 2020

For Mac, with fontsave target, you can pipe curl into bsdtar to save a few immediate steps:

fontsave:
	@if test ! `which unzip` ; then \
		echo 'Install unzip first.' >&2 ; \
		exit 128 ; \
		fi
	@if test ! -e .fontello ; then \
		echo 'Run `make fontopen` first.' >&2 ; \
		exit 128 ; \
		fi
	curl --silent --show-error --fail \
		${FONTELLO_HOST}/`cat .fontello`/get \
		| bsdtar --strip-components=1 -xf- -C $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment