mrmcc3 / tailwind-cljs-example

Example Setup - Tailwind + ClojureScript
16 stars 0 forks source link

Makefile as package.json scripts alternative #1

Open Ramblurr opened 4 years ago

Ramblurr commented 4 years ago

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
mrmcc3 commented 4 years ago

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