Running Frugal

Frugal does not come with any CLI to run your projet. Instead, it lets you write your own production and development scripts.

Development mode

When running in development mode, Frugal will ignore the exporter configuration. Instead, Frugal will setup a dev server with livereload :

dev.ts
import { context } from "https://deno.land/x/frugal@0.9.5/mod.ts"
import config from "./frugal.config.ts"

await context(config).watch()
1
2
3
4
Warning

After the call to watch, since we used await, the script will await on the server to terminate. Since the server should never terminate, any code you write after the awaited watch won't run.

Tip

This script is the ideal place to load a .dotenv file.

The dev server should listen on port 3000, but you can change it by passing a port number to the watch function.

Production mode

In production mode, frugal will build and export your project and exit :

build.ts
import { build } from "https://deno.land/x/frugal@0.9.5/mod.ts"
import config from "./frugal.config.ts"

await build(config)
1
2
3
4

Since the build function does not start a long running process, you can execute something else after the build is done.