cd /opt
git clone https://github.com/swifweb/webber
cd /opt/webber
swift build -c release
ln -s /opt/webber/.build/release/Webber /usr/bin/webber
exec bash
Start using it inside of your project folder
To update webber to latest version just do
cd /opt/webber && git pull && swift build -c release
Usage
If you already have a project then just go to its folder in console
If you don’t then manually git clone a template and then go to its directory
New project
You can either simply execute webber new or clone one of templates manually
git clone https://github.com/swifweb/spa-template myspawebsite
cd myspawebsite
open Package.swift # to work with code
webber serve # to launch in browser
progressive web app
git clone https://github.com/swifweb/pwa-template mypwawebsite
cd mypwawebsite
open Package.swift # to work with code
webber serve -t pwa -s Service # to launch in browser
Development
if your project is single page application then this command will be enough to start working
webber serve
This command do:
compile your project into webassembly file
cook needed html and js files, store them into .webber hidden folder inside project directory
spinup local webserver
open default browser to see your web app (it is on http/2 by default with self-signed cert, so add it into system)
watch for changes in the project directory, rebuild project automatically and update page in browser
if you clone the pwa template then you should additionally provide the following arguments:
-t pwa to say webber that your project should be cooked as PWA
the name of your service worker target e.g. -s Service
so in the end serve command for pwa template could look like this
Webber
Powerful console tool for cooking your swifweb apps
Requirements
macOS 10.15 and Xcode 11.4 or later.
or
any ubuntu supported on swift.org
Installation
macOS
On macOS
webber
can be installed with Homebrew. Make sure you have Homebrew installed and then run:to update already installed version run
Ubuntu
binaryen
wasmer
npm
webber
To update
webber
to latest version just doUsage
If you already have a project then just go to its folder in console
If you don’t then manually
git clone
a template and then go to its directoryNew project
You can either simply execute
webber new
or clone one of templates manuallyprogressive web app
Development
if your project is
single page application
then this command will be enough to start workingThis command do:
.webber
hidden folder inside project directoryif you clone the
pwa
template then you should additionally provide the following arguments:-t pwa
to saywebber
that your project should be cooked as PWA-s Service
so in the end
serve
command forpwa
template could look like thisAdditional parameters
-v
or--verbose
to show more info in console for debugging purposes-p 443
or--port 443
to start webber server on443
port instead of default8888
--browser chrome/safari
to automatically open desired browser, by default it doesn’t open any--browser-self-signed
needed to debug service workers locally, otherwise they doesn’t work--browser-incognito
to open additional instance of browser in incognito mode, works only with chromeRelease
for SPA just run
for PWA execute it this way
and then grub your files from
.webber/release/
How to serve release files with
nginx
Install nginx by the official instrucation
Edit
/etc/nginx/mime.types
addapplication/wasm wasm;
in order to servewasm
files correctlyGenerate SSL certificate with letsencrypt (or anything else)
Declare your server like this
Credits
Infinite thanks to the swiftwasm organization for their
web
packagewebber
to cover all the needs