summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: ee3bdc2e75997effe88724dfd2502b341fd959ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
FILES_SRC := $(shell find src/icons -type f -name "*.svg")
FILES     := $(patsubst src/icons/%.svg,dist/%.svg,$(FILES_SRC))

all: files dist/sprite.svg showcase/index.html

files:  $(FILES)

###

dist/%.svg: src/icons/%.svg | dist
	scour -i "$<" \
		--enable-viewboxing \
		--enable-id-stripping \
		--enable-comment-stripping \
		--remove-descriptive-elements \
		--strip-xml-prolog \
		--shorten-ids | sed -z 's/\(fill\|stroke\)="#.\{3,6\}"/\1="currentColor"/g;s/stroke-width="[0-9.]*"//g;s/stroke-linecap="[a-z]*"//g;s/stroke-linejoin="[a-z]*"//g;s/style="[ a-z0-9:-]*"//g' > "$@"

showcase/index.html: src/showcase/index.html $(FILES) | showcase
	scripts/build_showcase.sh

showcase:
	mkdir -p showcase

dist:
	mkdir -p dist

###

.PHONY: all