Is there any way to create a cross-platform client application that consumes a fraction of resources than Electron would use... with Ruby? ๐คฏ
TLDR;
yes, this is the way ๐
Run
sh <(curl https://create.tauri.app/sh)-
Set:
-
Project name:
your-project(what you want) -
Choose which language to use for your frontend:
"TypeScript / JavaScript" -
Choose your package manager:
npm(what you want) -
Choose your UI template:
Vanilla -
Choose your UI flavor:
JavaScript
-
Project name:
-
Run:
gem install opalcd your-projectecho "puts 'Hello from Opal!'" | cat > src/main.rb- open
src/index.htmlfile and move<script type="module" src="/main.js" defer></script>line to the bottom mkdir src/appnpm installnpm run tauri dev
-
Edit
src-tauri/tauri.conf.json:- set
beforeDevCommandwith"opal --output=src/main.js --watch -c src/main.rb -I src/app" - set
beforeBuildCommandwith"opal -c src/main.rb --output=src/main.js --no-source-map -I src/app"
- set
Go to the window console (https://tauri.app/v1/guides/debugging/application/#webview-console),
you should seeHello from Opal!๐ฅณ

Amazing uh? But... what next?
- Add any
.rbfile insrc/appand require it fromsrc/main.rb, yeah that's it! - Build it with
npm run tauri build
~6MB Space (notice that I didn't minify or optimize anything...)
~20-30MB Ram (this is crazy)
Joseph ๐
Resources:
Opal guides
Tauri guides


Top comments (0)