-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (33 loc) · 1.53 KB
/
Makefile
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
MAKEFLAGS += --no-print-directory
.EXPORT_ALL_VARIABLES:
.PHONY: all start prepare css js build html
PATH := $(PWD)/node_modules/.bin:$(PATH)
SHELL := /bin/bash
all: DEV=false
start: DEV=true
all: prepare build html
# gzip --best --keep --no-name public/index.html
clean:
rm -rf node_modules public tmp && mkdir {public,tmp}
rm -f package-lock.json
start: prepare
node server --bang "$(MAKE) css js html" --scss "$(MAKE) css" --js "$(MAKE) js" --watch "src"
prepare:
@echo ""
rm -rf public tmp && mkdir {public,tmp}
cp -r src/assets/* public
@echo ""
css:
node-sass src/main.scss --quiet --source-map-contents --include-path node_modules --source-map true --output public
js:
esbuild src/app.js --bundle --sourcemap=external --define:DEV=true --define:STATIC=false --outfile=public/app.bundle.js
tsc public/app.bundle.js --allowJs --sourceMap --lib DOM,ES2015 --target ES5 --outFile public/app.js
parcel-source-map --map public/app.bundle.js.map --map public/app.js.map --out public/app.js.map
html:
esbuild src/index.js --bundle --define:DEV=$(DEV) --define:STATIC=true --platform=node | node > public/index.html
build:
esbuild src/app.js --bundle --minify --define:DEV=false --define:STATIC=false > tmp/app.bundle.js
tsc tmp/app.bundle.js --allowJs --lib DOM,ES2015 --target ES5 --outFile tmp/app.bundle.es5.js
uglifyjs tmp/app.bundle.es5.js --toplevel -m -c drop_console=true,passes=3 > public/app.min.js
node-sass src/main.scss --quiet --include-path node_modules --output tmp
cleancss -O2 tmp/main.css --output public/main.min.css