Created
July 11, 2020 07:42
-
-
Save whaaaley/7d46081af1fa0467ad45ab367453826a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAKEFLAGS += --no-print-directory | |
.EXPORT_ALL_VARIABLES: | |
.PHONY: all start prepare css js production html | |
PATH := $(PWD)/node_modules/.bin:$(PATH) | |
SHELL := /bin/bash | |
all: NODE_ENV=true | |
start: NODE_ENV=false | |
all: prepare production html | |
gzip --best --keep --no-name public/index.html | |
start: prepare | |
@echo "" | |
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 | |
css: | |
node-sass src/main.scss --quiet --source-map-contents --source-map true --output public | |
js: | |
esbuild src/app.js --bundle --sourcemap --define:NODE_ENV=$(NODE_ENV) --outfile=public/app.js | |
html: | |
esbuild src/index.js --bundle --define:NODE_ENV=$(NODE_ENV) --platform=node | node > public/index.html | |
production: | |
tsc src/app.js --allowJs --lib --target es5 --outDir tmp | |
esbuild tmp/app.js --bundle --minify --define:NODE_ENV=$(NODE_ENV) --outfile=public/app.min.js | |
node-sass src/main.scss --quiet --output tmp | |
cleancss -O2 tmp/main.css --output public/main.min.css |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment