Skip to main content
Module

x/cav/mod.ts>prepareAssets

A server framework for Deno
Go to Latest
function prepareAssets
Re-export
import { prepareAssets } from "https://deno.land/x/cav@0.0.23/mod.ts";

Asset preparation procedure that does the following:

  • Bundles every bundle.ts(x) or *_bundle.ts(x) file in the folder (recursive) into an adjacent file with the same name plus a .js suffix
  • Optionally uses a filesystem watcher to rebundle whenever a change is made to a bundle file or one of its local dependencies.

When the watch option is true, any errors encountered during bundling will be logged and suppressed, and the prepareAssets() call will start a file system watching event loop that re-triggers asset preparation whenever a file changes inside the assets directory. It will return immediately after the initial prep.

If the --unstable or --allow-write permissions are not available, this function silently does nothing. i.e. In production, you can safely omit those flags and still call this function; no errors will be thrown.

Parameters

opt: { cwd?: string; dir?: string; watch?: boolean; }