web

package
v0.5.48 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: BSD-3-Clause Imports: 46 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Web compilation

This code is extensively based on maxence-charriere/go-app.

MIT License (Copyright (c) 2016 Maxence Charriere)

Documentation

Overview

Package web provides functions for building Cogent Core apps for the web.

Index

Constants

View Source
const GoscriptModule = "github.com/s4wave/goscript"

GoscriptModule is the Go module of the GoScript compiler.

View Source
const GoscriptPackage = "github.com/s4wave/goscript/cmd/goscript"

GoscriptPackage is the Go package of the GoScript compiler command.

View Source
const JSTags = "purego,noasm,mvmnosrc"

JSTags are the build tags (besides goscript) that apps are built with for the js platform, and that core test js uses. The mvmnosrc tag leaves the standard library sources out of the mvm interpreter (mvmcore), which only runs code using the packages bound to it, so that it adds much less to the bundle.

Variables

This section is empty.

Functions

func Build

func Build(c *config.Config) error

Build builds an app for web using the given configuration information.

func IsJS added in v0.5.0

func IsJS(c *config.Config) bool

IsJS returns whether the given configuration is building for the js platform, which compiles the app to JavaScript using GoScript (https://github.com/s4wave/goscript) instead of to WebAssembly. Otherwise, the js platform produces the same static website as web.

func Serve

func Serve(c *config.Config) error

Serve serves the build output directory on the default network address at the config port. Text files and the app bundle are served compressed with gzip, as static site hosts do, so that the download sizes are the same as when deployed.

func SetupJS

func SetupJS() error

SetupJS installs the tools of the js platform that are not installed: GoScript and bun, which build apps to JavaScript, and tsrs, which goscript test type checks the compiled code with (core build js does not need it, as bun only strips the types).

func ToolPath added in v0.5.8

func ToolPath(tool string) string

ToolPath returns the path of the given tool that the js platform uses (goscript or bun), on the PATH or in the directory it is normally installed in, or "" if it is not installed.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL