Files
KaTeX/Makefile
Emily Eisenberg bd6f762f94 Improve the fonts.less experience
Summary:
Create a fonts.less file which generates identical css to fonts.css, but using
less rules to be more understandable and customizable. For example, add the
ability to change where the fonts directory is located (instead of mandating it
be located next to the less file), and add the ability to disable specific font
formats (like disable EOTs when IE8 support isn't needed).

Test Plan:
 - Ensure that the test page and huxley page still work
 - Ensure that the output of `./node_modules/.bin/lessc static/fonts.less` is
   the same as the original css by running both through
   `./node_modules/.bin/cleancss` and diffing them.
 - Ensure that the huxley screenshots haven't changed
 - Ensure that the build step still works

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D13326
2014-09-22 14:23:23 -07:00

59 lines
1.5 KiB
Makefile

.PHONY: build setup copy serve clean metrics test zip
build: setup build/katex.min.js build/katex.min.css zip compress
setup:
npm install
build/katex.js: katex.js $(wildcard src/*.js)
./node_modules/.bin/browserify $< --standalone katex > $@
build/katex.min.js: build/katex.js
./node_modules/.bin/uglifyjs --mangle < $< > $@
build/%.less.css: static/%.less
./node_modules/.bin/lessc $< $@
build/katex.min.css: build/katex.less.css
./node_modules/.bin/cleancss -o $@ $<
.PHONY: build/fonts
build/fonts:
rm -rf $@
mkdir $@
for font in $(shell grep "font" static/katex.less | grep -o "KaTeX_\w\+" | cut -d" " -f 2 | sort | uniq); do \
cp static/fonts/$$font* $@; \
done
.PHONY: build/katex
build/katex: build/katex.min.js build/katex.min.css build/fonts README.md
mkdir -p build/katex
cp -r $^ build/katex
build/katex.tar.gz: build/katex
cd build && tar czf katex.tar.gz katex/
build/katex.zip: build/katex
cd build && zip -rq katex.zip katex/
zip: build/katex.tar.gz build/katex.zip
compress: build/katex.min.js build/katex.min.css
@$(eval JSSIZE!=gzip -c build/katex.min.js | wc -c)
@$(eval CSSSIZE!=gzip -c build/katex.min.css | wc -c)
@$(eval TOTAL!=echo ${JSSIZE}+${CSSSIZE} | bc)
@printf "Minified, gzipped js: %6d\n" "${JSSIZE}"
@printf "Minified, gzipped css: %6d\n" "${CSSSIZE}"
@printf "Total: %6d\n" "${TOTAL}"
serve:
node server.js
test:
./node_modules/.bin/jasmine-node test/katex-spec.js
metrics:
cd metrics && ./mapping.pl | ./extract_tfms.py | ./extract_ttfs.py | ./replace_line.py
clean:
rm -rf build/*