teknql / shadow-cljs-tailwind-jit

Shadow build hooks for enabling JIT compilation of Tailwind CSS
95 stars 10 forks source link

shadow-cljs-tailwind-jit fails to start watch on MS-Windows #10

Closed ikappaki closed 2 years ago

ikappaki commented 2 years ago

shadow-cljs-tailwind-jit fails to start the watch on MS-Windows throwing the following error:

shadow-cljs - config: d:\clj\issues\issue-jit-windows\shadow-cljs.edn
shadow-cljs - updating dependencies
shadow-cljs - dependencies updated
shadow-cljs - HTTP server available at http://localhost:3000
shadow-cljs - server version: 2.15.12 running at http://localhost:9630
shadow-cljs - nREPL server started on port 53231
shadow-cljs - watching build :ui
[:ui] Configuring build.
[:ui] Using default value for :tailwind/files.
[:ui] Using default value for :tailwind/config.
[:ui] Using default value for :postcss/config.
[:ui] Starting postcss process.
[:ui] Build failure:
Hook [0 teknql.tailwind/start-watch!] failed in stage :configure
IOException: Cannot run program "./node_modules/.bin/postcss": CreateProcess error=193, %1 is not a valid Win32 application
    java.lang.ProcessBuilder.start (ProcessBuilder.java:1143)
    java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    babashka.process/process (process.clj:224)
    babashka.process/process (process.clj:204)
    babashka.process/process (process.clj:208)
    babashka.process/process (process.clj:204)
    teknql.tailwind/start-watch! (tailwind.clj:106)
    teknql.tailwind/start-watch! (tailwind.clj:67)
... 

Steps to reproduce:

  1. Create a shadow-cljs draft projectwith npx create-cljs-project issue-jit-windows and cd to it.
  2. Install npm dependencies as required by shadow-cljs-tailwind-jit: npm install --save-dev postcss-cli@8.3.1 tailwindcss autoprefixer cssnano
  3. Update shadow-cljs.edn with the least boiler plate possible for shadow-cljs-tailwind-jit:

    ;; shadow-cljs configuration
    {:source-paths
    ["src/dev"
    "src/main"
    "src/test"]
    
    :dependencies
    [[com.teknql/shadow-cljs-tailwind-jit "0.2.2"]]
    
    :builds
    {:ui
    {:target :browser
    :output-dir "resources/public/js"
    :asset-path "/js"
    :modules {:main {:init-fn clojure.core/println}}
    :dev
    {:build-hooks
    [(teknql.tailwind/start-watch!)]}
    :release
    {:build-hooks
    [(teknql.tailwind/compile-release!)]}
    :devtools
    {:http-root   "resources/public/" ;; Must be set to infer default purge targets.
    :http-port   3000}
    :tailwind/output "resources/public/css/site.css"}}}
  4. Start the shadow-cljs watch which will invoke the teknql.talwind watch. The above error is thrown when the latter is started.

The issue is that the the node postcss script that teknql.tailwind invokes has a different extension on MS-Windows than in *nix.

Patch to follow.

rschmukler commented 2 years ago

Fixed in v1! Thanks