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 serverThe following scripts are available:
bun start: build all static assets indist/and start a server in production modebun devto start a dev server, loading all static assets in memory frompublic/(and with dev mode, autoreload and file watcher)bun run buildto build all static assets intodist/folder
This project template provides the following features:
- starting point for an owl application
- all templates are collected from
srcand injected into the page - autoreload (in dev mode)
main.jsis 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.htmlis the main page that will serve as index page.public/app.jsis the main entry point for the owl application
The server located in core has the following routes:
- for route
/, it readspublic/app.htmland inject templates, and autoreload code (in dev mode) - for route
/app.js, it bundles all code inpublic/usingapp.jsas 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_pathwill be concatenated and injected in html page. Otherwise, a<link href="app.css"/>will be injected instead, and the/app.cssroute will return the content of all css filesinline_xml(default: false): same as the css, but for all xml files