Skip to content

Instantly share code, notes, and snippets.

@tj
Last active March 11, 2017 13:31
Show Gist options
  • Save tj/11de76415dfaf25fcef3c5aad41359bf to your computer and use it in GitHub Desktop.
Save tj/11de76415dfaf25fcef3c5aad41359bf to your computer and use it in GitHub Desktop.
imgix favicons
IMAGE_CDN = https://apex-inc.imgix.net
# Imgix image replacement.
images:
@echo "==> pointing images to $(IMAGE_CDN)"
@find build -type f -name "*.html" | xargs sed -i '' 's|src="/images|src="$(IMAGE_CDN)/images|g'
@find build -type f -name "*.html" | xargs sed -i '' 's|href="/images|href="$(IMAGE_CDN)/images|g'
.PHONY: images
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="/images/favicons/dark.png?w=57" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/images/favicons/dark.png?w=114" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/images/favicons/dark.png?w=72" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/images/favicons/dark.png?w=144" />
<link rel="apple-touch-icon-precomposed" sizes="60x60" href="/images/favicons/dark.png?w=60" />
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="/images/favicons/dark.png?w=120" />
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="/images/favicons/dark.png?w=76" />
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="/images/favicons/dark.png?w=152" />
<link rel="icon" type="image/png" href="/images/favicons/dark.png?w=196" sizes="196x196" />
<link rel="icon" type="image/png" href="/images/favicons/dark.png?w=96" sizes="96x96" />
<link rel="icon" type="image/png" href="/images/favicons/dark.png?w=32" sizes="32x32" />
<link rel="icon" type="image/png" href="/images/favicons/dark.png?w=16" sizes="16x16" />
<link rel="icon" type="image/png" href="/images/favicons/dark.png?w=128" sizes="128x128" />
@tj
Copy link
Author

tj commented Mar 6, 2017

Example with mmake:

IMGIX_DIR = build
IMGIX_SOURCE_NAME = apex-inc

include github.com/tj/make/static/imgix

build: ... imgix.replace

deploy: clean build
  ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment