blob: 02a4048aa7540e90815ad3efdbbca230823bd0f9 (
plain) (
blame)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
NODE ?= node
NPM ?= npm
NPX ?= npx
RM ?= rm
GZIP ?= gzip
TOUCH ?= touch
BROTLI ?= brotli
ESBUILD ?= node_modules/esbuild/bin/esbuild
CONCURRENTLY ?= node_modules/concurrently/bin/concurrently.js
FILES = ../priv/static/assets/site.css ../priv/static/assets/site.js ../priv/static/assets/alcoolog.js
FILES_GZ := $(addsuffix .gz, $(FILES))
FILES_BR := $(addsuffix .br, $(FILES))
FILES_CONTROLLERS := $(shell find controllers/ -name '*.js')
.PHONY: all
all: node_modules $(FILES) $(FILES_GZ) $(FILES_BR)
node_modules: package.json package-lock.json
$(NPM) install
@$(TOUCH) node_modules
../priv/static/assets/%.css: %.css
NODE_ENV=production $(NPX) tailwindcss --postcss --minify -i $< -o $@
../priv/static/assets/%.js: %.js $(FILES_CONTROLLERS) script/build.%.js
#NODE_ENV=production $(ESBUILD) $< --bundle --minify --target=es2016 --outfile=$@
NODE_ENV=production $(NODE) script/build.$<
../priv/static/assets/%.js.gz: ../priv/static/assets/%.js
$(GZIP) --force --best --keep $<
@$(TOUCH) $@
../priv/static/assets/%.css.gz: ../priv/static/assets/%.css
$(GZIP) --force --best --keep $<
@$(TOUCH) $@
../priv/static/assets/%.js.br: ../priv/static/assets/%.js
$(BROTLI) --force --best --keep $<
@$(TOUCH) $@
../priv/static/assets/%.css.br: ../priv/static/assets/%.css
$(BROTLI) --force --best --keep $<
@$(TOUCH) $@
.PHONY: clean
clean:
$(RM) $(FILES) $(FILES_GZ) $(FILES_BR)
.PHONY: watch
watch: #watch_css watch_js
$(CONCURRENTLY) --kill-others -n css,js "make watch_css" "make watch_js"
.PHONY: watch_css
watch_css:
NODE_ENV=development $(NPX) tailwindcss --input=site.css --output=assets/site.css --postcss --watch
.PHONY: watch_js
watch_js:
#NODE_ENV=development $(ESBUILD) site.js --bundle --sourcemap=inline --watch --outfile=assets/site.js
NODE_ENV=development $(NODE) script/watch.site.js
|