A starter template to create owl projects using bun. This is only a toy (around 300 loc), not production ready!
To create a new project:
bun create ged-odoo/owl-project-template [destination]
cd [destination]
bun dev # to start a dev server
The following scripts are available:
bun start
: build all static assets indist/
and start a server in production modebun dev
to start a dev server, loading all static assets in memory frompublic/
(and with dev mode, autoreload and file watcher)bun run build
to build all static assets intodist/
folder
This project template provides the following features:
- starting point for an owl application
- all templates are collected from
src
and injected into the page - autoreload (in dev mode)
main.js
is the main entry point. It checks for dev mode, and start the server accordinglycore/
is meant to contain the code that organize the application (so, a framework). This means:- managing assets
- a simple autoreload feature
- a basic http server
public/
is the location for the owl application code (the browser code). Note that all xml files will be
injected intothe main page (look at page source)public/app.html
is the main page that will serve as index page.public/app.js
is the main entry point for the owl application
The server located in core
has the following routes:
- for route
/
, it readspublic/app.html
and inject templates, and autoreload code (in dev mode) - for route
/app.js
, it bundles all code inpublic/
usingapp.js
as the entry point - for route
/owl.js
, it returns the owl file fromnode_modules
- other files are statically served from
public/
(in dev mode) ordist/
(in prod mode)
Here is the list of supported keys in app_config
key in package.json:
port
: the port that the server will listen topublic_path
: the (relative) folder containing all the static code for the applicationbuild_path
: the (relative) folder that will be used as target for the build processother_static_files
: a description of all additional static files available to the server. For example:{ "other_static_files": { "milligram.css": "node_modules/milligram/dist/milligram.css" } }
inline_css
(default: false): if true, all css files inpublic_path
will be concatenated and injected in html page. Otherwise, a<link href="app.css"/>
will be injected instead, and the/app.css
route will return the content of all css filesinline_xml
(default: false): same as the css, but for all xml files