Documentation navigation
Anybuild documentation

Static Files

Serve an existing directory of HTML, CSS, JavaScript, and other static assets.

Detection

The static-file provider recognizes a Staticfile, a root index.html, or public/index.html. It can also serve an explicitly selected directory without running a build step.

Configuration

FieldPurposeExample value
static_dirDirectory copied into the static application artifact.public
sws_versionVersion of static-web-server used by the deploy runner.2.38.0
convert_redirectsConvert a _redirects file into static-web-server rules.true
Anybuild
load("//anybuild/tools:staticfile.bzl", "staticfile_build", "staticfile_config", "staticfile_serve")
config = staticfile_config(    schema = 1,    sws_version = "2.38.0",    static_dir = "public",)
build = staticfile_build(config)
staticfile_serve(config, build, name = "site")

Redirects

When redirect conversion is enabled, Anybuild reads _redirects from the configured root and generates the equivalent static-web-server configuration.