mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 11:18:39 +00:00
Summary: Add checks in the makefile to not run mac-only things when not on a mac. (I've only tested on linux, I haven't ensured that this runs mac-only things on a mac) Test Plan: - Run `make` - Have it not break Reviewers: alpert Reviewed By: alpert Differential Revision: http://phabricator.khanacademy.org/D7260
41 lines
897 B
Makefile
41 lines
897 B
Makefile
UNAME=$(shell uname)
|
|
|
|
.PHONY: build setup copy serve clean
|
|
build: setup build/katex.js build/katex.less.css
|
|
ifeq ($(UNAME),Darwin)
|
|
build: pdiff
|
|
endif
|
|
|
|
setup:
|
|
npm install
|
|
ifeq ($(UNAME),Darwin)
|
|
brew install webkit2png
|
|
brew install graphicsmagick
|
|
endif
|
|
|
|
compress: build/katex.min.js
|
|
@printf "Minified, gzipped size: "
|
|
@gzip -c $^ | wc -c
|
|
|
|
build/katex.js: katex.js $(wildcard *.js)
|
|
./node_modules/.bin/browserify $< --standalone katex > $@
|
|
|
|
build/katex.min.js: build/katex.js
|
|
uglifyjs --mangle < $< > $@
|
|
|
|
build/katex.less.css: static/katex.less
|
|
./node_modules/.bin/lessc $< > $@
|
|
|
|
serve:
|
|
node server.js
|
|
|
|
pdiff:
|
|
@printf "Creating new pdiff image...\n"
|
|
@webkit2png http://localhost:7936/test/pdiff.html -F --transparent -D build -o pdiff >/dev/null 2>&1
|
|
@mv build/pdiff-full.png build/pdiff.png
|
|
@printf "Comparing to reference pdiff image...\n"
|
|
@node test/pdiff.js
|
|
|
|
clean:
|
|
rm -rf build/*
|