Documentation
¶
Overview ¶
Package devtheme keeps the dev directory of .dev/server, themes/dev/dev/0.0.0/, in sync with a theme project during umono theme dev.
Index ¶
Constants ¶
const Path = "themes/dev/dev/0.0.0"
Path is the dev directory under .dev/server.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// Contract is the contract reference of theme.toml.
Contract string
// Err is the error of the checks of build, nil when they pass.
Err error
// Warnings are those of Lint when the checks pass.
Warnings []themecore.Warning
}
State is the outcome of Sync, what the dev proxy shows in its overlay.
func Sync ¶
func Sync(ctx context.Context, projectDir, serverDir string, r themeproject.Registry, now time.Time) (State, error)
Sync brings the dev directory under serverDir up to date with the theme project projectDir, on start and on every change of the project. The contract is the cached file of theme.toml's reference, fetched from r when missing. The links are made (makeLinks) and built.toml is rewritten with the id dev/dev, the version 0.0.0 and the theme-api-version of the current detection. When the checks of build fail, the version is the CLI's ThemeAPICurrent, so Umono still loads the theme; the failure is State.Err. An error is returned when the dev directory cannot be brought up to date: theme.toml or the contract cannot be had, or a write fails.