mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
* Create a separate entry point for webpack
Created a webpack entry point for KaTeX, which imports katex.less. As
flow[1] and jest[2] doesn't support CSS modules natively, a separate
entry point is used and it is not flowtyped.
[1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef
[2] https://facebook.github.io/jest/docs/en/webpack.html
* Use webpack to build files
* Made webpack.config.js export valid webpack configuration
* Use:
browserify -> webpack
babelify -> babel-loader
UglifyJS CLI -> UglifyJsPlugin
Less CLI -> less-loader
cleancss -> cssnano in css-loader
build/fonts -> file-loader
* Inline CSS(Less) using style-loader and export them using
ExtractTextPlugin
* Add `watch` npm script calling `webpack --watch`
* Improve local testing(webpack-dev-server)
* Made webpackDevServer export a valid webpack configuration
* Compile Less and inline CSS using less-loader and style-loader
* Instead of copying files serve files from /static and use file-loader
* Remove old server.js and its dependencies
* Use webpack-dev-server in Screenshotter
* Include contrib in webpack-dev-server
+ Moved common configurations to webpack.common.js
* Rename webpackDevServer.js to webpack.dev...
to be consistent, avoid confusion with webpack-dev-server and follow
webpack configuration naming convention.
* Remove unnecessary conditional output.path
* Use map instead of reduce
+ Add comments regarding function arguments
* Remove unnecessary mkdir and clean build/* before build
* Use katex as external dependency instead of global variable in contrib
Fixes #692.
* Unblock codes as they are built as a module
* Update package-lock.json
* Add comments regarding devServer option
* Lint renamed webpack.dev.js
a0d8b33
* Export ES6 module and expose its default export
* Revert "Browserify hotfix (#1057)"
This reverts commit f6b509123b
.
* Enables colors on the console when running the dev server in Screenshotter
* Add context to webpack configuration
Allows webpack to be run from other directories
* Move `rm -rf build/*` to npm scripts
* Check dependencies before build
* Move UglifyJsPlugin into config creation
* Let webpack handle ES6 modules
Do not transform modules to commonjs in Babel. However Jest doesn't not
support ES6 modules, so transfrom modules to commonjs when NODE_ENV is
`test`.
* Add documentation on testing in IE 9 and 10 using webpack-dev-server
Changed version range to include IE-compatible version
96 lines
2.5 KiB
Makefile
96 lines
2.5 KiB
Makefile
.PHONY: build dist lint setup webpack serve clean metrics test coverage zip flow
|
|
build: test build/katex zip compress
|
|
|
|
ifeq ($(KATEX_DIST),skip)
|
|
|
|
dist:
|
|
|
|
else
|
|
|
|
dist: build
|
|
rm -rf dist/
|
|
cp -R build/katex/ dist/
|
|
|
|
endif
|
|
|
|
NODE := node # pass NODE=nodejs on Debian without package nodejs-legacy
|
|
NPM := npm
|
|
NODECHK := $(shell $(NODE) ./check-node-version.js)
|
|
ifneq ($(NODECHK),OK)
|
|
$(error "Node not found or wrong version")
|
|
endif
|
|
|
|
# The prepublish script in package.json will override the following variable,
|
|
# setting it to the empty string and thereby avoiding an infinite recursion
|
|
NIS = .npm-install.stamp
|
|
|
|
$(NIS) setup: package.json
|
|
KATEX_DIST=skip npm install # dependencies only, don't build
|
|
@touch $(NIS)
|
|
|
|
lint: $(NIS)
|
|
$(NPM) run lint
|
|
|
|
webpack: katex.js $(wildcard src/*.js) $(wildcard static/*.less) $(NIS)
|
|
$(NPM) run build
|
|
|
|
.PHONY: build/fonts build/contrib
|
|
build/katex.js build/katex.min.js build/katex.css build/katex.min.css build/katex.css build/fonts build/contrib: webpack
|
|
|
|
test/screenshotter/unicode-fonts:
|
|
git clone https://github.com/Khan/KaTeX-test-fonts test/screenshotter/unicode-fonts
|
|
cd test/screenshotter/unicode-fonts && \
|
|
git checkout 99fa66a2da643218754c8236b9f9151cac71ba7c && \
|
|
cd ../../../
|
|
|
|
.PHONY: build/katex
|
|
build/katex: build/katex.js build/katex.min.js build/katex.css build/katex.min.css build/fonts README.md build/contrib
|
|
mkdir -p build/katex
|
|
rm -rf 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
|
|
rm -f $@
|
|
cd build && zip -rq katex.zip katex/
|
|
|
|
zip: build/katex.tar.gz build/katex.zip
|
|
|
|
compress: build/katex.min.js build/katex.min.css
|
|
@JSSIZE=`gzip -c build/katex.min.js | wc -c`; \
|
|
CSSSIZE=`gzip -c build/katex.min.css | wc -c`; \
|
|
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: $(NIS)
|
|
$(NPM) start
|
|
|
|
flow: $(NIS)
|
|
$(NPM) run flow
|
|
|
|
test: $(NIS)
|
|
$(NPM) test
|
|
|
|
coverage: $(NIS)
|
|
$(NPM) run coverage
|
|
|
|
PERL=perl
|
|
PYTHON=$(shell python2 --version >/dev/null 2>&1 && echo python2 || echo python)
|
|
|
|
metrics:
|
|
cd metrics && $(PERL) ./mapping.pl | $(PYTHON) ./extract_tfms.py | $(PYTHON) ./extract_ttfs.py | $(PYTHON) ./format_json.py --width > ../src/fontMetricsData.js
|
|
|
|
unicode:
|
|
cd src && $(NODE) unicodeMake.js >unicodeSymbols.js
|
|
src/unicodeSymbols.js: unicode
|
|
|
|
clean:
|
|
rm -rf build/* $(NIS)
|
|
|
|
screenshots: test/screenshotter/unicode-fonts $(NIS)
|
|
dockers/Screenshotter/screenshotter.sh
|