asseter

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 19 Imported by: 0

README

Asseter

Go Reference

A Go tool for managing and embedding static assets in your web applications. Asseter helps you copy, version, and generate code for serving static files with support for both standard http and gin web frameworks.

Requirements

  • Go 1.24 or higher

Installation

go get github.com/pudottapommin/asseter/cmd/asseter
# or 
go get -tool github.com/pudottapommin/asseter/cmd/asseter

Usage

Commands
copy - Copy assets to output directory

Copies static assets from a source directory to a distribution directory, with optional font copying from node_modules.

Usage:

Options:

Flag Default Description
-cwd "" Working directory (where node_modules are located)
-src "src" Source directory for assets
-dist "dist" Distribution directory for assets
-fontDist "files" Fonts distribution directory (rooted from dist)
-exclude - Exclude paths by glob pattern (can be used multiple times)
-font - Font source names to copy from node_modules (can be used multiple times)
gen - Generate assets_gen.go file

Generates Go code for serving static assets with optional embedding and versioning support.

Usage:

Options:

Flag Default Description
-cwd "" Working directory (where node_modules are located)
-src "dist" Directory containing assets to process
-dist "assets" Directory where Go file will be generated
-pkg "assets" Package name for the generated Go file
-server "http" HTTP server binding (http or gin)
-urlPrefix "/static" URL path prefix for all assets
-embed false Embed assets into the binary
-hash false Generate versioned asset filenames with hashes
-exclude - Exclude paths by glob pattern (can be used multiple times)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetsFsHandler added in v0.3.0

type AssetsFsHandler struct {
	// contains filtered or unexported fields
}

func NewAssetsFsHandler added in v0.3.0

func NewAssetsFsHandler(o AssetsFsOptions) (*AssetsFsHandler, error)

func (*AssetsFsHandler) Run added in v0.3.0

func (h *AssetsFsHandler) Run() error

type AssetsFsOptions added in v0.3.0

type AssetsFsOptions struct {
	Src string
	Pkg string
	Out string
}

type CopyHandler

type CopyHandler struct {
	// contains filtered or unexported fields
}

func NewCopyHandler

func NewCopyHandler(opts CopyOptions) (cmd *CopyHandler, err error)

func (*CopyHandler) Run

func (cmd *CopyHandler) Run(ctx context.Context) (err error)

type CopyOptions

type CopyOptions struct {
	Cwd          string
	SrcDir       string
	DistDir      string
	Exclude      FileMatchFlag
	Fonts        FontSourceFontsFlag
	DistFontsDir string
}

type FileMatchFlag

type FileMatchFlag []string

func (*FileMatchFlag) Match

func (e *FileMatchFlag) Match(path string) bool

func (*FileMatchFlag) Set

func (e *FileMatchFlag) Set(value string) error

func (*FileMatchFlag) String

func (e *FileMatchFlag) String() string

type FontSourceFontsFlag

type FontSourceFontsFlag []string

func (*FontSourceFontsFlag) Match

func (e *FontSourceFontsFlag) Match(path string) bool

func (*FontSourceFontsFlag) Set

func (e *FontSourceFontsFlag) Set(value string) error

func (*FontSourceFontsFlag) String

func (e *FontSourceFontsFlag) String() string

Directories

Path Synopsis
cmd
asseter command

Jump to

Keyboard shortcuts

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