tailwind-cljs-example
tailwind-cljs-example copied to clipboard
Makefile as package.json scripts alternative
Thanks for the great example, it saved me a bunch of time.
I use a luminus generated project, which manages the package.json from lein, so I can't add scripts to the package.json (or I haven't figured out how that is).
Here's a little Makefile adapted from the scripts, if anyone finds it useful.
NPX ?= npx
CSS_IN ?= resources/public/css/screen.css
CSS_OUT_DIR ?= resources/public/css
CSS_OUT ?= $(CSS_OUT_DIR)/app.css
tailwind-css:
$(NPX) tailwind build $(CSS_IN) -o $(CSS_OUT)
purge-css:
$(NPX) purgecss -c purgecss.config.js -o $(CSS_OUT_DIR)
clean-css:
$(NPX) cleancss -o $(CSS_OUT) $(CSS_OUT)
release-css: tailwind-css purge-css clean-css
dev: tailwind-css
$(NPX) lein shadow-cljs watch app
build: release-css
lein shadow-cljs release app
FYI purgecss is now included in tailwind. So you can scrap the purge config file and use the tailwind config file instead. Just use NODE_ENV=production to get tailwind to purge.
I've updated the examples