25 lines
510 B
Makefile
25 lines
510 B
Makefile
|
dist/minified:
|
||
|
mkdir -p dist/minified
|
||
|
|
||
|
UGLIFYJS := ./node_modules/.bin/uglifyjs
|
||
|
# $1: The file to minify
|
||
|
define minify
|
||
|
$(shell ${UGLIFYJS} --mangle --compress -o "./dist/minified/$(notdir $1)" -- $1)
|
||
|
endef
|
||
|
|
||
|
node_modules:
|
||
|
npm install
|
||
|
|
||
|
.PHONY: watch
|
||
|
watch: node_modules
|
||
|
npm start
|
||
|
|
||
|
.PHONY: build
|
||
|
build: node_modules dist/minified
|
||
|
@echo Building with parcel
|
||
|
./node_modules/.bin/parcel build
|
||
|
|
||
|
@echo Minifying
|
||
|
$(foreach file, $(wildcard dist/*.js), $(call minify, $(file)))
|
||
|
$(shell ls -lah ./dist/minified)
|