Skip to content

Commit

Permalink
[IMP] tools: expose template compiler as npm command
Browse files Browse the repository at this point in the history
Previously, we made it possible to compile templates ahead of time as
this was required by the owl devtools. Unfortunately, no effort was made
at the time to make this ahead-of-time compiler outside of the owl repo.

This commit refactors the AoT template compiler by splitting it in two
parts: a typescript module that gets bundled in the dist folder that
gives a programmatic way to call the standalone compiler from another
javascript module by importing it, and a command line utility that is
exposed as an executable files available to npm run-script of dependent
modules (configured in the bin field of owl's package.json).

This allows a simple workflow for modules wanting to use owl:

`npm install @odoo/owl`

add a script to your package.json that calls compile_owl_templates on
your source files, eg:

```jsonc
{
  // ...
  "scripts": {
    "build": "compile_owl_templates src -o dist/templates.js"
  }
}
```

`npm run build`
  • Loading branch information
odoo authored and ged-odoo committed Jan 9, 2025
1 parent 9b656fd commit b31fa81
Show file tree
Hide file tree
Showing 7 changed files with 1,001 additions and 351 deletions.
Loading

0 comments on commit b31fa81

Please sign in to comment.