shadow-cljs¶
NGINX Configuration for developping locally¶
Install nginx on your remote server and place this file into your configuration.
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
server_name _;
location / {
proxy_pass http://localhost:8080/;
try_files $uri $uri/a 404;
}
location /shadow-cljs/ {
# upgrade to websocket
proxy_pass http://localhost:9630/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
}
- Open the ports: `sudo ufw 8080` and `sudo ufw 9630`.
- Connect directly to the ip/domain of the server with the correct ports.
Inspect¶
Inject the correct namespaces with :devtools
preloads in the
shadow-cljs.edn
config file.
{:devtools
{:preloads [shadow.remote.runtime.cljs.browser
;; shadow.remote.runtime.cljs.node ;; for nodejs
]}}
Inspect with Clojure and not only ClojureScript
(require '[shadow.cljs.devtools.server :as server])
(server/start!)
(tap> :hello)
Devcards¶
For devcards 0.2.7, we have to make the following adjustment for making it work with shadow-cljs.
{:builds
{:app
{:build-options {:ns-aliases {devcards-marked cljsjs.marked
devcards-syntax-highlighter cljsjs.highlight}}}}}
(ns cljsjs.marked
(:require ["marked" :as marked]))
(js/goog.exportSymbol "marked" marked)
(js/goog.exportSymbol "DevcardsMarked" marked)
(ns cljsjs.highlight
(:require ["highlight" :as highlight]))
(js/goog.exportSymbol "highlight" highlight)
(js/goog.exportSymbol "DevcardsSyntaxHighlighter" highlight)
Sources¶
https://clojureverse.org/t/introducing-shadow-cljs-inspect/5012