https://github.com/thheller/cordova-cljs
bare bones example using shadow-cljs with cordova
https://github.com/thheller/cordova-cljs
Last synced: 8 months ago
JSON representation
bare bones example using shadow-cljs with cordova
- Host: GitHub
- URL: https://github.com/thheller/cordova-cljs
- Owner: thheller
- Created: 2020-03-03T11:27:40.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-17T14:34:44.000Z (over 5 years ago)
- Last Synced: 2025-03-16T16:38:51.720Z (about 1 year ago)
- Language: Clojure
- Size: 19.5 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cordova example using shadow-cljs
Only tested using the `windows` platform. Other platforms should work too but maybe require some tweaks. Maybe they just work.
Project skeleton created by `npx create-cljs-project cordova-cljs`.
Then
```bash
$ cordova create MyApp
$ cd MyApp
$ cordova platform add windows
# add support for console.log (required since the devtools try to log)
$ cordova plugin add cordova-plugin-console
```
Start shadow-cljs, config outputs to `MyApp/www/js`.
```
$ shadow-cljs watch app
```
Adjust the `MyApp/www/index.html` to load the proper output and rewrite or remove the `Content-Security-Policy` since it will otherwise block the `shadow-cljs` websocket connection.
```html
Hello World
```
And finally run the app.
```bash
$ cordova run windows
```
## Android
In order for hot code reloading to work on Android you need to do two things:
### Enable clear text traffic.
By default Android will block clear text traffic. You can allow it by adding the following to your `config.xml` file.
```
```
Note that you might want to disable this in production.
### Add devtools-url
Android emulators will not know how to access localhost, so instead you need to
point it to `10.0.2.2`. You can do this by adjusting the `:devtools`:
```
:devtools {:use-document-host false
:devtools-url "http://10.0.2.2:9630"}
```