pkgsitegolang.org/x/pkgsite/internal/static Index | Files

package static

import "golang.org/x/pkgsite/internal/static"

Package static builds static assets for the frontend and the worker.

Index

Functions

func Build

func Build(config Config) error

Build compiles TypeScript files into minified JavaScript files using github.com/evanw/esbuild.

This function is used in Server.staticHandler with Watch=true when cmd/frontend is run in dev mode and in devtools/cmd/static/main.go with Watch=false for building productionized assets.

Types

type Config

type Config struct {
	// EntryPoint is a directory in which to build TypeScript
	// sources.
	EntryPoint string

	// Bundle is true if files imported by an entry file
	// should be joined together in a single output file.
	Bundle bool

	// Watch is true in development. Sourcemaps are placed inline,
	// the output is unminified, and changes to any TypeScript
	// files will force a rebuild of the JavaScript output.
	Watch bool
}

Source Files

config.go static.go

Version
v0.0.0-20250218150137-224a1368cf02 (latest)
Published
Feb 18, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
2 months ago

Tools for package owners.