build

package
v0.0.0-...-09dfd77 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

package build creates in-memory HTML documents for use by the server & build commands.

In its simplest form, our View type contains a reference to the contents of a markdown file and contains implementations for methods that create a document using one of the following:

  1. a template in its frontmatter
  2. a template with the same name as the file (sans extensions)
  3. the base template

Then executes (renders) the template by placing it in some stream, be it file, stdout or stderr.

Index

Constants

This section is empty.

Variables

View Source
var BuildCommand = &cli.Command{
	Name:   "build",
	Usage:  "build your site to your configured directory (defaults to dist)",
	Flags:  config.BuildFlags(true),
	Action: Run,
}
View Source
var BuildLogger *log.Logger = logs.CreateConsoleLogger("[build]")
View Source
var ScriptFile string

Functions

func CopyJS

func CopyJS(conf *config.Config) error

When using the default template, {views}/base, we want to bundle assets/theme.js to ensure that the user can access the basic light/dark toggler.

TODO: this should be configurable

func Run

func Run(ctx context.Context, c *cli.Command) error

Types

type Builder

type Builder struct {
	Config *config.Config
	Logger *log.Logger
}

type FilePath

type FilePath struct {
	FileP string
	Name  string
}

func CollectStatic

func CollectStatic(c *config.Config) ([]*FilePath, error)

func CopyStaticFiles

func CopyStaticFiles(c *config.Config) ([]*FilePath, error)

CopyStaticFiles creates the build dir at d, the provided destination directory as well as the static files directory at {dest}/assets

Jump to

Keyboard shortcuts

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